Skip to content

Wire the researcher role into the agent loop (WI-042) - #123

Merged
nateshpp merged 2 commits into
mainfrom
feature/researcher-agent-loop-integration
Jul 7, 2026
Merged

nateshpp merged 2 commits into
mainfrom
feature/researcher-agent-loop-integration

Conversation

@nateshpp

@nateshpp nateshpp commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

planCycle already resolved a generic crew role (WI-040): a role named in role_sequence
beyond the built-in maker/checker pair resolves its provider, transport, and route with no
core-code change. What was missing was the researcher's own prompt, and a way to run it on
an independent schedule. This closes both gaps.

prompts/roles/researcher.txt has the agent read the repo's own durable state
(STATUS.md, DECISIONS.md, the existing work items), draft one well-scoped proposal, run
it past the independent check at Checkpoint 1 (scripts/agent/review-proposals.mjs,
ADR-040), and, only on APPROVE: yes, author and self-validate (validate-work-item.mjs) a
schema-valid work item. It never claims, makes, or checks the item itself, a researcher
proposes, it does not build.

A new --roles a,b,c CLI override on run-cycle.mjs (resolveRoleSequence now takes an
opts argument) lets a single invocation run just the researcher, or any other subset, on
its own schedule (matching ADR-040's operating model: research, make, and check can run
independently), without editing role_sequence in config. Absent the override, behavior is
unchanged: cfg.role_sequence, then the maker/checker default.

planCycle also now fails closed during planning when a role in the executed sequence has
no prompt file at prompts/roles/<role>.txt, caught at dry-run time rather than surfacing
only as an ENOENT deep inside a real --execute run. Closes WI-042.

Governance checklist

  • npm run verify passes locally (drift guard + style check + tests + AgentProof)
  • No em dashes in any tracked file (the style check rejects them)
  • Prose states conclusions directly (style check rejects hedging phrases)
  • No AI co-author lines in commit messages
  • If ratchet logic changed: N/A, no ratchet logic touched
  • If a new AgentProof scenario: N/A, no new AgentProof scenario
  • If config schema changed: N/A, no schema change; CHANGELOG entry added regardless
  • If prompt changed: N/A, no core prompt bundle change (a new role prompt file, not a
    bundle edit)

Test evidence

# tests 830
# suites 17
# pass 830
# fail 0
# cancelled 0
# skipped 0
# todo 0

AgentProof: Score: 25/25 normative | 10/10 extended (35/35 total)
Level: HARDENED

New coverage: tests/researcher-role.test.mjs (8 tests) covers the researcher prompt
rendering with its substitutions, the --roles CLI parser, resolveRoleSequence's override
precedence, planCycle running the researcher alone and in an extended sequence, and the
new fail-closed check for a role with no prompt file (both for a real run and for dry-run).

planCycle already resolved a generic crew role (WI-040); this closes
the two gaps left open. prompts/roles/researcher.txt has it read the
repo's own state, draft one proposal, run it past the independent
check at Checkpoint 1 (review-proposals.mjs, ADR-040), and, only on
approval, author and self-validate a schema-valid work item. It never
claims, makes, or checks the item itself.

A new --roles CLI override on run-cycle.mjs lets a single invocation
run just the researcher, or any other subset, on its own schedule,
without editing role_sequence in config. Absent the override, behavior
is unchanged.

planCycle now also fails closed during planning when a role in the
executed sequence has no prompt file, caught at dry-run time rather
than surfacing only as an ENOENT deep inside a real --execute run.
@nateshpp
nateshpp requested a review from techseek4vr as a code owner July 7, 2026 03:00
Resolves conflicts against WI-041 (runtime model fallback, #122),
which merged first: both branches touched run-cycle.mjs and
CHANGELOG.md's Unreleased section for complementary, non-overlapping
features. Regenerates the snapshot from scratch.
@nateshpp
nateshpp merged commit a2315df into main Jul 7, 2026
8 checks passed
@nateshpp
nateshpp deleted the feature/researcher-agent-loop-integration branch July 7, 2026 05:36
nateshpp added a commit that referenced this pull request Jul 7, 2026
Resolves conflicts against WI-042 (the researcher role, #123), which
merged just after WI-041 was already reconciled here. Only generated
artifacts conflicted this time (snapshot, RELEASE-EVIDENCE.md,
site/index.html); run-cycle.mjs and CHANGELOG.md auto-merged cleanly
since the two branches touch different regions.
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