feat(harness): apply slim rules layer to named and SDD agents - #54
feat(harness): apply slim rules layer to named and SDD agents#54pablontiv wants to merge 4 commits into
Conversation
📝 WalkthroughWalkthroughRefactors the orchestrator prompt loader to read from disk on each call with error fallback, introduces a harness reminder system that injects context-aware reminders into the message stream on compaction events, injects ChangesHarness Reminder System and Prompt Refactor
Sequence Diagram(s)sequenceDiagram
participant Session as Session Runtime
participant CPFlag as compactionPending flag
participant ACR as applyHarnessReminder
participant BCR as buildContextReminder
participant Messages as Message Array
Session->>CPFlag: session_start → false
Session->>CPFlag: session_compact → true
Session->>ACR: context event (messages)
ACR->>Messages: remove prior harness reminders
ACR->>BCR: build reminder
BCR->>CPFlag: read → true, then reset to false
BCR-->>ACR: reminder with optional post-compaction block
ACR->>Messages: append reminder as last item
ACR-->>Session: updated messages
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Suggested labels
🚥 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 |
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 1923-1932: The module-global `compactionPending` boolean variable
at line 1923 is shared across all concurrent sessions, causing state leakage
where one session's compact event affects another session's reminder injection.
Replace the single `compactionPending` variable with a per-session map or object
keyed by session ID. Update the `buildContextReminder()` function to look up the
pending state using the current session's ID instead of reading the global flag,
and update all code that sets or consumes this flag (at lines 2024-2030) to use
the session ID as the key when accessing and modifying the per-session state
map.
🪄 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: 74456142-fabd-413e-bdbf-84e60d4494c3
📒 Files selected for processing (3)
extensions/gentle-ai.tstests/gentle-ai.test.tstests/runtime-harness.mjs
1a2cb5a to
bbe005a
Compare
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).
bbe005a to
c29a14f
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 `@tests/runtime-harness.mjs`:
- Around line 216-219: The test assertions in the subagent prompt validation
currently only check that the identity string is absent but do not explicitly
verify that SDD preflight markers are absent from non-SDD subagent prompts,
which means the contract that non-SDD subagents must not receive SDD preflight
is not actually enforced. Add explicit negative assertions using
assert.doesNotMatch for the relevant SDD preflight markers and patterns to the
subagentPromptResult.systemPrompt check, and apply the same assertions to other
locations where non-SDD subagent prompt validation occurs.
🪄 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: 43f7add8-6076-48e1-a8bc-629e5b4d6c71
📒 Files selected for processing (3)
extensions/gentle-ai.tstests/gentle-ai.test.tstests/runtime-harness.mjs
c29a14f to
73166e6
Compare
Part of #39 (please read the design note in the issue before reviewing this one). Stacked on #42 (review the last commit only).
Summary
gentlePrompt. This PR keeps persona, identity, and orchestrator content out of them (that part of the design is unchanged) and appends a 9-line discipline floor instead: scope confinement, destructive-command safety, TDD evidence, no nested orchestration, honest reporting.Changes
extensions/gentle-ai.tsAGENT_SLIM_RULESconst;before_agent_startappends it for named/SDD agents instead of the empty stringtests/gentle-ai.test.tstests/runtime-harness.mjsTest plan
pnpm testgreen at this commit on currentmain: 168 pass, 0 fail (full stack). Original count on the older base was 67.Notes
This is the one PR in the stack that revisits a deliberate design choice. If you prefer subagents fully clean, closing this PR drops the change without affecting #40, #41, or #42.
Summary by CodeRabbit
Release Notes
Bug Fixes
New Features
Tests