Add librarian survey mode for batch promote-scan

scripts/librarian_survey.py walks docs/archive/*.md and dispatches
every entry without a research counterpart through the same prompt
assembly as librarian_promote.py. Outputs land under
runs/tmp/librarian-survey-<timestamp>/, classified into:
  <stem>.md            draft, ready to copy into docs/research/
  <stem>.SKIP.txt      LLM's one-line "not promotable" reason
  <stem>.ERROR.txt     CLI stderr if the call itself failed

Counterpart detection uses exact stem match plus a tail-match
heuristic so research notes that intentionally drop a domain prefix
still suppress their archive. Verified against the current tree:
docs/archive/deep-cfr-opponent-policy-network-divergence-* is
correctly recognized as already covered by
docs/research/opponent-policy-network-divergence.md.

--dry-run lists candidates and suggested research targets without
calling the LLM. --max N caps processed archives per run, useful as
a cost guard. Sequential dispatch; one LLM call per archive.

Plan updated to mark survey mode complete.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-08 01:18:28 +09:00
co-authored by Claude Opus 4.7
parent f5ce49682e
commit b0b385591b
2 changed files with 220 additions and 4 deletions
+16 -4
View File
@@ -220,14 +220,26 @@ prose, no bullet soup. Accepted verbatim as
oversize finding → extracted archive → LLM draft → human accept —
closed without touching the LLM's output.
## Stage 2 v2: survey mode
`scripts/librarian_survey.py`. Walks `docs/archive/*.md`, filters
out entries that already have a research counterpart (exact stem
match or tail match — research notes sometimes drop a domain
prefix), and dispatches each remaining archive to the same prompt
template as `librarian_promote.py`. Outputs land under
`runs/tmp/librarian-survey-<timestamp>/`, one file per archive,
classified into `<stem>.md` (draft), `<stem>.SKIP.txt` (LLM judged
non-promotable), or `<stem>.ERROR.txt` (CLI failure).
`--dry-run` lists candidates without calling the LLM. `--max N`
caps the number of archives processed per run, useful for smoke
tests or cost control.
## Stage 2 remaining
- MEMORY.md drift fixup mode (read drift report, propose one-line
diffs).
diffs). Currently no drift to act on, so deferred.
- Duplicate-doc merge proposal mode.
- Survey mode: scan all archive entries lacking a research
counterpart and run `librarian_promote` on each, accumulating
drafts under one timestamped directory.
## Next Concrete Step