Skip to content

feat(0.x): researcherProfile + multiHarnessResearcherFanout (1.3.0)#14

Merged
tangletools merged 2 commits into
mainfrom
feat/researcher-profile
May 24, 2026
Merged

feat(0.x): researcherProfile + multiHarnessResearcherFanout (1.3.0)#14
tangletools merged 2 commits into
mainfrom
feat/researcher-profile

Conversation

@tangletools
Copy link
Copy Markdown
Contributor

Summary

Phase 1.A of the driven-loop substrate push. Ships
researcherProfile() + multiHarnessResearcherFanout() as a new sub-
export @tangle-network/agent-knowledge/profiles. Pairs with
@tangle-network/agent-runtime/loops — the profile owns prompt + output
adapter + validator; the runtime kernel owns iteration, concurrency,
cost, abort, and trace emission.

  • Three validator invariants: namespace isolation (cross-tenant writes
    hard-fail), provenance (every item carries >= 1 evidence entry),
    citation density floor (default 0.7).
  • Propose-don't-apply: the profile emits KnowledgeUpdate[]; the
    caller decides whether to route them through
    applyKnowledgeWriteBlocks / a KbStore put. The profile module
    imports no FS primitive — enforced by a test that scans the source.
  • Loose output: items, citations, proposedWrites are required;
    gaps, notes, and any agent extras land in raw rather than
    getting dropped. Validator scoring:
    0.4·citation_density + 0.2·source_diversity + 0.2·recency_match + 0.2·gap_coverage.
  • Three-harness default fanout: opencode/zai-coding-plan/glm-5.1,
    claude-code, codex.
  • agent-builder god-object (1665 LOC) NOT touched in this PR; audit
    doc captures the extraction map for a follow-up agent-builder PR.

Substrate audit findings

Full audit: /tmp/agent-knowledge-audit.md. Summary of the three
primitives the spec demanded:

Primitive State This PR
Multi-tenant namespace PARTIAL — KnowledgeFreshnessStore is per-workspaceId; KbStore + types are single-tenant Validator enforces namespace at the profile layer; defence-in-depth. Substrate-wide promotion = follow-up PR.
Provenance + confidence + supersede + retract PARTIAL — KnowledgeClaim has refs/confidence/status; no top-level KnowledgeItem with supersedes[] / retractedAt / authoredBy Profile ships local KnowledgeItem whose field names match the eventual substrate promotion 1:1.
Propose + materialize GOOD — parseKnowledgeWriteBlocks / applyKnowledgeWriteBlocks already separate proposal from materialize Profile honours the contract; never calls materialize.

One PR (not two) because the two PARTIAL primitives don't block the
researcher work — the validator + profile-local types deliver the
spec's invariants today, and the follow-up substrate refactor will
collapse them one-for-one without changing the profile surface.

Test plan

  • pnpm typecheck clean (strict + noUncheckedIndexedAccess)

  • pnpm build clean (tsup ESM + DTS, new dist/profiles/ entry)

  • pnpm test — 88 passed / 5 skipped (5 skipped are pre-existing
    live-HTTP tests; 24 new tests across validator + adapter +
    multi-harness + runLoop integration)

  • biome check src tests — no new warnings (2 pre-existing in
    unchanged src/lint.ts + src/wikilinks.ts)

  • manual smoke through dist:

    ```
    decision: pick-winner
    iterations: 2
    winner.agentRunName: researcher-stub-a
    winner.verdict.valid: true
    winner.verdict.score: 1.000
    winner proposedWrites: 1
    ```
    

Follow-ups (deferred — out of scope here)

  • feat/knowledge-primitives — promote KnowledgeClaim → top-level
    KnowledgeItem substrate-wide; add namespace to KbStore get/put;
    collapse profile-local types.
  • agent-builder refactor: consume researcherProfile from
    auto-research-runner.ts. Target: drop ~1000 LOC from the 1665-line
    god-object. Domain-generic loop pieces move out; persona pool +
    lineage + budget + cycle deadline + decideRepairAction stay.

drewstone added 2 commits May 24, 2026 11:16
Source-grounded research profile that pairs with @tangle-network/agent-
runtime/loops. The profile ships an AgentProfile, prompt formatter,
output adapter, and validator; the runtime kernel owns iteration,
concurrency, cost, and trace emission.

Three invariants the validator enforces:
  - namespace isolation — cross-tenant items + proposedWrites hard-fail
  - provenance — every item carries at least one evidence entry
  - citation density — quotes-with-source / items >= floor (default 0.7)

Propose-don't-apply: the profile emits KnowledgeUpdate[] in the output;
the caller decides whether to route through applyKnowledgeWriteBlocks
/ a KbStore put. The profile module imports no FS primitives.

New subpath export: @tangle-network/agent-knowledge/profiles. Tests
cover validator scoring (good + bad), namespace isolation,
propose-without-materialize, loose-output passthrough (raw[] preserves
agent extras), and end-to-end runLoop through a stub sandbox.
@tangletools tangletools merged commit eaa165b into main May 24, 2026
1 check passed
@tangletools tangletools deleted the feat/researcher-profile branch May 24, 2026 17:39
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.

2 participants