feat(harness): re-anchor discipline via context event on every LLM call - #52
feat(harness): re-anchor discipline via context event on every LLM call#52pablontiv wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughReplaces the cached ChangesHarness Reminder Injection and Orchestrator Prompt Refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
1dab94a to
20bedc2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@extensions/gentle-ai.ts`:
- Around line 1920-1928: The buildContextReminder function has a
self-referential return type annotation ReturnType<typeof buildContextReminder>
which creates a circular reference that TypeScript rejects. Remove the explicit
return type annotation completely from the function signature and allow
TypeScript to infer the return type directly from the object literal being
returned, which contains the role, customType, content, display, and timestamp
properties.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1da1d833-d75e-4b38-82ea-90502886f717
📒 Files selected for processing (2)
extensions/gentle-ai.tstests/gentle-ai.test.ts
Registers pi.on("context") handler that injects a gentle-harness-reminder message before each LLM call, ensuring the orchestrator pattern, TDD discipline, and artifact-driven decisions are reinforced at every interaction point — not just at agent start.
The handler returns a new message array with the reminder appended as the last message. It deduplicates if a reminder is already present (defensive for chained extensions). The reminder content is a single source of truth module constant and includes all el Gentleman discipline markers.
Pure logic exposed via __testing for verification. Full suite green (58/58 pass, runtime harness exit 0).
20bedc2 to
6edc0e4
Compare
Part of #39. Stacked on #40 (review the last commit only).
Summary
contextevent and appends a compact harness reminder before every LLM call, including iterations aftersteer()/followUp()wherebefore_agent_startdoes not fire.role: "custom"message (Pi converts it to a user message for the provider). Per-call ephemeral by design: the transform result is used for that single call and never persisted to session history.Changes
extensions/gentle-ai.tsbuildContextReminder(),applyHarnessReminder(),pi.on("context")registrationtests/gentle-ai.test.tsTest plan
pnpm testgreen at this commit on currentmain: 161 pass, 0 fail. Original count on the older base was 60.Notes
The reminder costs roughly 90 tokens per call. Its content lives in a single module const so it stays the only source of truth.
Summary by CodeRabbit
New Features
Tests