Skip to content

feat(1.3.0): proposeFromFinding — AnalystFinding → knowledge proposal bridge#10

Closed
drewstone wants to merge 2 commits into
mainfrom
feat/propose-from-finding
Closed

feat(1.3.0): proposeFromFinding — AnalystFinding → knowledge proposal bridge#10
drewstone wants to merge 2 commits into
mainfrom
feat/propose-from-finding

Conversation

@drewstone
Copy link
Copy Markdown
Contributor

Summary

  • New proposeFromFinding(finding) / proposeFromFindings(findings) — closes the analysis → wiki side of the recursive-self-improvement loop. An AnalystFinding whose subject starts with agent-knowledge: becomes a typed KnowledgeProposal that downstream review/apply pipelines can act on.
  • Subject grammar (locked at the analyst-prompt boundary):
    • agent-knowledge:wiki:<slug> / agent-knowledge:wiki:<slug>#<heading> — create/update a wiki page
    • agent-knowledge:claim:<topic> — draft a claim row
    • agent-knowledge:raw:<source-id> — lift raw → curated
    • agent-knowledge:stale:<slug> — mark a page superseded
    • any other subject → null (the orchestrator's improvement-applier owns it)
  • Fail-loud parser: a subject the analyst intended as knowledge but malformed raises KnowledgeProposalParseError carrying findingId + subject so the loop can log + halt rather than silently accepting an underspecified edit.
  • Output shape matches KnowledgeAdapter.proposeFromFindings from @tangle-network/agent-runtime/analyst-loop, so wiring the adapter is a one-liner.
  • Bumps @tangle-network/agent-eval peer to ^0.29.1 for the published AnalystFinding type; cuts 1.3.0.

Test plan

  • pnpm test — 76/81 pass (5 pre-existing network-gated skips)
  • pnpm typecheck
  • pnpm lint

drewstone added 2 commits May 19, 2026 14:57
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).
@drewstone
Copy link
Copy Markdown
Contributor Author

Superseded — main already has the proposeFromFinding bridge via #9. Cut v1.3.0 directly on main; publish workflow triggered.

@drewstone drewstone closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant