refactor(agent): Refine ingest, query, and lint workflows

This commit is contained in:
Matteo Cherubini 2026-05-11 10:16:15 +02:00
parent b440221514
commit d406a0a554

View file

@ -59,10 +59,11 @@ Session end or return to `disabled`: remind operator to run `git-crypt lock` on
Execute in this order before any file operation:
1. Read `wiki/index.md` — full catalog of all pages and their maturity.
2. Read the last 20 log entries injected by orchestrator — do not open `wiki/log.md` directly.
3. For any task involving related pages: `qmd search "<query>"` before opening files.
4. Operate on individual target files. Never scan entire directories.
1. **One source per session.** If multiple sources are queued in `raw/`, process only the first. Commit, close session. The orchestrator starts a new session for the next source.
2. Read `wiki/index.md` — full catalog of all pages and their maturity.
3. Read the last 20 log entries injected by orchestrator — do not open `wiki/log.md` directly.
4. For any task involving related pages: `qmd search "<query>"` before opening files.
5. Operate on individual target files. Never scan entire directories.
---
@ -78,7 +79,8 @@ Execute in this order before any file operation:
5. Check each touched page for contradictions → apply §Conflict if found.
6. Append entry to `wiki/index.md` (bottom of relevant section).
7. Append log entry: `INGEST | <slug>`.
8. Commit on `feat/ai-ingest-<slug>`. Open PR.
8. Run scoped lint on pages created or modified in this session. Report issues in PR description. Do not auto-fix.
9. Commit on `feat/ai-ingest-<slug>`. Open PR using `templates/pr-description.md`.
*Private source* (`PRIVATE_CONTEXT: enabled` required):
- All output → `wiki/private/<slug>.md` only.
@ -88,24 +90,28 @@ Execute in this order before any file operation:
*Triggered by operator question.*
1. `qmd search "<query>"` → identify candidate pages.
2. Read relevant pages via `wiki/index.md` catalog.
2. Read candidate pages directly.
3. Synthesize answer with `[[wikilink]]` citations.
4. If answer is non-trivial: save as `wiki/queries/<slug>.md`.
5. Append entry to `wiki/index.md` under Queries.
6. Append log entry: `QUERY | <subject>`.
*For general orientation without a specific query: read `wiki/index.md` directly.*
### Lint
*Triggered by operator or schedule.*
*Triggered by operator with bash pre-scan output.*
Find and report — do not auto-fix without operator approval:
Pre-requisite: operator runs `bash scripts/lint-genomes.sh` and provides output to this session.
The script handles deterministically: broken links, knowledge decay, page size, frontmatter validation.
1. Orphan pages — no inbound `[[wikilink]]`.
2. Duplicate concepts — two pages covering same topic → propose merge.
3. Implicit concepts — term in 3+ pages with no dedicated page.
4. `maturity: draft` with 2+ sources → propose promote to `stable`.
5. Broken internal links.
6. Knowledge decay violations (§Decay).
Agent tasks — apply semantic judgment to bash findings + independent semantic checks:
1. **Orphan pages** (list from bash): for each orphan, identify 1-3 existing pages that should link to it. Propose specific link additions.
2. **Implicit concepts** (term list from bash): for each candidate term, determine if a dedicated page is warranted. If yes, draft stub.
3. **Duplicate concepts**: `qmd search "<concept>"` for suspected duplicates → propose merge if confirmed.
4. **`maturity: draft`** pages with 2+ sources cited → propose promote to `stable`.
Report all findings as structured list. Do not modify files without operator approval.
Append log entry: `LINT | <summary of findings>`.
---