feat(1.3.0): proposeFromFinding — AnalystFinding → knowledge proposal bridge#10
Closed
drewstone wants to merge 2 commits into
Closed
feat(1.3.0): proposeFromFinding — AnalystFinding → knowledge proposal bridge#10drewstone wants to merge 2 commits into
drewstone wants to merge 2 commits into
Conversation
Closes the analysis → wiki side of the recursive-self-improvement
loop. A knowledge-gap or knowledge-poisoning finding produced by an
analyst now converts directly into a typed `KnowledgeProposal` an
operator (or auto-merge bot) can review and apply through the
existing `applyKnowledgeWriteBlocks` pipeline.
Subject grammar parsed (stamped in the analyst-kind prompts):
agent-knowledge:wiki:<page-slug> → create-page
agent-knowledge:wiki:<page-slug>#<heading> → append-section
agent-knowledge:claim:<topic> → create-claim (draft)
agent-knowledge:raw:<source-id> → lift-raw
agent-knowledge:stale:<page-slug> → mark-stale
Anything else (websearch:outdated:*, tool-doc:*, system-prompt:*,
memory:*) returns `null` — those loci aren't knowledge-base concerns
and the loop's improvement-applier (next PR, agent-runtime) handles
them. A knowledge-base subject that's malformed throws
`KnowledgeProposalParseError` rather than skipping — analyst-prompt
bugs fail loud, not silent.
API:
proposeFromFinding(finding): KnowledgeProposal | null
proposeFromFindings(findings): { proposals, skipped, errors }
Proposal id is stable per finding (`prop-${finding_id}`) so cross-run
diffs share an identity — proposing the same finding twice returns
the same proposal. `metadata` carries severity / confidence /
evidence_uri / analyst_id so reviewers see the source.
Markdown rendering:
- create-page emits frontmatter (title, status: draft,
drafted_from_finding, confidence) + body with H1 + rationale +
recommended-action sections
- append-section emits an H2 with the heading + inline H3
subsections so the appender doesn't clobber existing prose
- lift-raw and mark-stale emit their own canonical templates with
sourceId / supersedes pointers
Slugs are sanitised (lowercase, [^a-z0-9-] → -, trimmed to 200 chars)
so the existing `isSafeKnowledgePath` allow-list accepts the writes.
Tests (12 passing, plus 64 inherited green = 76 total):
- null for non-knowledge subjects (websearch / tool-doc / system-
prompt / memory / missing)
- each of the five wiki kinds round-trips path + content
- claim refs map AnalystFinding.evidence_refs → ClaimRef shape
- malformed `agent-knowledge:wiki:` throws KnowledgeProposalParseError
- unknown kind throws KnowledgeProposalParseError
- proposal id stable across re-runs
- unsafe slug characters sanitised
- batch helper partitions proposals / skipped / errors
Bumps `@tangle-network/agent-eval` peer to `^0.28.0` (AnalystFinding +
typed kinds shipped there in #56).
Contributor
Author
|
Superseded — main already has the proposeFromFinding bridge via #9. Cut v1.3.0 directly on main; publish workflow triggered. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
proposeFromFinding(finding)/proposeFromFindings(findings)— closes the analysis → wiki side of the recursive-self-improvement loop. AnAnalystFindingwhosesubjectstarts withagent-knowledge:becomes a typedKnowledgeProposalthat downstream review/apply pipelines can act on.agent-knowledge:wiki:<slug>/agent-knowledge:wiki:<slug>#<heading>— create/update a wiki pageagent-knowledge:claim:<topic>— draft a claim rowagent-knowledge:raw:<source-id>— lift raw → curatedagent-knowledge:stale:<slug>— mark a page supersedednull(the orchestrator's improvement-applier owns it)KnowledgeProposalParseErrorcarryingfindingId+subjectso the loop can log + halt rather than silently accepting an underspecified edit.KnowledgeAdapter.proposeFromFindingsfrom@tangle-network/agent-runtime/analyst-loop, so wiring the adapter is a one-liner.@tangle-network/agent-evalpeer to^0.29.1for the publishedAnalystFindingtype; cuts 1.3.0.Test plan
pnpm test— 76/81 pass (5 pre-existing network-gated skips)pnpm typecheckpnpm lint