v0.21 alpha add research brief and compressed findings

This commit is contained in:
kai
2026-05-06 19:23:30 +08:00
parent db626f1d58
commit 0644a68ecc
13 changed files with 539 additions and 27 deletions
+11 -3
View File
@@ -26,7 +26,7 @@ from scripts.lib.model_config import (
parse_model_overrides,
resolve_model_profile,
)
from scripts.runtime.assembly import build_chapter_briefs, run_chapter_assembly_workers
from scripts.runtime.assembly import build_chapter_briefs, build_compressed_findings, run_chapter_assembly_workers
from scripts.runtime.orchestrator import create_phase2_task_cards, write_placeholder_packets
from scripts.runtime.methods import ResearchMethodRegistry
from scripts.runtime.phase1 import create_project, render_framework, write_material_brief
@@ -258,11 +258,14 @@ def cmd_research(args: argparse.Namespace) -> int:
packet_count = len(list((project_root / "phase2" / "packets").glob("*.json")))
brief_count = 0
chapter_count = 0
compressed_count = 0
source_count = None
if args.build_briefs or args.assemble_chapters:
source_count = rebuild_sources_from_packets(project_root)
briefs = build_chapter_briefs(project_root)
brief_count = len(briefs)
compressed_findings = build_compressed_findings(project_root)
compressed_count = len(compressed_findings)
if args.assemble_chapters:
from scripts.lib.zenmux_client import ZenMuxClient, load_secrets
@@ -273,7 +276,7 @@ def cmd_research(args: argparse.Namespace) -> int:
chapter_count = run_chapter_assembly_workers(
project_root=project_root,
briefs=briefs,
briefs=compressed_findings,
runtime=runtime,
client_factory=chapter_client_factory,
workers=args.workers,
@@ -288,6 +291,7 @@ def cmd_research(args: argparse.Namespace) -> int:
print(f"Sources rebuilt: {source_count}")
if args.build_briefs or args.assemble_chapters:
print(f"Chapter briefs: {brief_count}")
print(f"Compressed findings: {compressed_count}")
if args.assemble_chapters:
print(f"Chapter drafts: {chapter_count}")
if args.dry_run:
@@ -298,7 +302,7 @@ def cmd_research(args: argparse.Namespace) -> int:
print("Wrote: phase2/task_cards.json and validated phase2/packets/*.json")
print("Next: rerun with --build-briefs to aggregate packets into chapter briefs.")
elif args.build_briefs:
print("Wrote: phase2/chapter_briefs/*.json")
print("Wrote: phase2/chapter_briefs/*.json and phase2/compressed_findings/*.json")
print("Next: rerun with --assemble-chapters to write Chinese chapter drafts.")
else:
print("Wrote: phase2/task_cards.json and phase2/packets/*.json")
@@ -373,6 +377,8 @@ def cmd_status(args: argparse.Namespace) -> int:
drafts = sorted((project_root / "phase2" / "drafts").glob("ch*.md"))
evidence = sorted((project_root / "phase2" / "evidence").glob("ch*-evidence.md"))
task_cards = project_root / "phase2" / "task_cards.json"
research_brief = project_root / "phase1" / "research_brief.json"
compressed_findings = sorted((project_root / "phase2" / "compressed_findings").glob("ch*.json"))
packet_counts = packet_state_counts(project_root)
sources = project_root / "phase2" / "sources.jsonl"
final_en = project_root / "phase4" / "final_en.md"
@@ -399,6 +405,7 @@ def cmd_status(args: argparse.Namespace) -> int:
print()
print("Artifacts:")
print(f" framework: {file_state(project_root / 'phase1' / 'framework.md')}")
print(f" research_brief.json: {file_state(research_brief)}")
print(f" task_cards.json: {file_state(task_cards)}")
print(
" packets: "
@@ -410,6 +417,7 @@ def cmd_status(args: argparse.Namespace) -> int:
f"total={packet_counts['total']}"
)
print(f" drafts: {len(drafts)}")
print(f" compressed findings: {len(compressed_findings)}")
print(f" evidence files: {len(evidence)}")
print(f" sources: {source_count}")
print(f" final_en.md: {file_state(final_en)} ({en_words:,} words)")