fix(agent-kit): provide full thread context to first-time participating roles #476
Reference in New Issue
Block a user
Delete Branch "fix/473-first-time-role-context"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
First-time participating roles (e.g. committer) now receive full thread history instead of just the last step output.
Why
When a role has never participated before, the continuation prompt only contained system prompt + last step output. The role had no idea what happened in earlier steps, causing hallucination — e.g. committer inventing parameter names that differ from the actual implementation (#473).
Changes
workflow-protocol/types.ts— addisFirstVisittoAgentContextworkflow-agent-kit/context.ts— addisFirstVisitdetection helperworkflow-agent-kit/build-continuation-prompt.ts— detect first-time roles and include all steps meta + last 2-3 steps content (within quota)workflow-agent-hermes/hermes.ts— passisFirstVisitthrough to prompt builderworkflow-agent-kit/__tests__/context.test.ts— new test file for isFirstVisitworkflow-agent-kit/__tests__/build-continuation-prompt.test.ts— tests for first-time context enrichmentworkflow-agent-hermes/__tests__/hermes-prompt.test.ts— updated testscli-workflow/commands/thread.ts— minor adjustmentRef
Fixes #473