fix(harness): plan-first sessions are ordinary sessions with map tools [SAP-3143] - #835
fix(harness): plan-first sessions are ordinary sessions with map tools [SAP-3143]#835gwitwer wants to merge 3 commits into
Conversation
…s [SAP-3143] A project's Plan Agents session launched with a replacement system prompt that forbade scaffolding, editing, running, and deploying, so the session Studio opened a user into could not build an agent. A project session is an ordinary session that also has the Agent Map tools: it now loads the served authoring prompt like every other session and appends the map context (read, validate, propose; keep the map current; build directly when asked). The prohibition sentences and the "not to implement it yet" SessionStart copy are removed. Tests re-pointed to the appended shape. Stopgap until Yash's #820/#826 stack deletes the planner profile. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DUq2aqxS5DQtG6aPvoYtn7
Review — PR #835 (round 1)No confidentiality issues: the changeset and comments name only Sapiom and Studio surfaces. 1. The served authoring prompt forces a generic orientation into every planner session
The planner's own context says the opposite — Failure: a user opens Plan Agents, reads "Use this session to plan and build", types a goal, and the The tests can't catch this: Fix: have 2. Patch level reverts behavior that shipped as a Minor
3. Copy did not travel: non-Claude planners still say planning-onlyThe new "plan and build" copy reaches Claude Code sessions only. Two surfaces still say the session
Both are the same root cause as the SessionStart change and belong in this PR. Nits
Verdict: request changes — finding 1 is a user-visible regression in the flow this PR is meant |
Review round 1: the served prompt's mandatory first-reply orientation would have run in planner sessions on top of the SessionStart message, so the appended map context now countermands it. The non-Claude onboarding sentence and the greeting prompt say plan and build. Changeset is minor, since the 0.13.0 read-only planning profile is removed. The wiring test stub carries the orientation clause and asserts the override lands after it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DUq2aqxS5DQtG6aPvoYtn7
Review — PR #835 (round 2, follow-up)Delta reviewed: Earlier findings — all three addressed
Nit 2 (call-count assertions) is addressed, though New findingsNone that break or leak. Nits
Verdict: approve — the push resolved every round-1 finding; the two remaining items are |
…nnot make Review round 2 nit: sessionStartSystemMessage is only set on create, so the appended context no longer asserts the user saw an orientation. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DUq2aqxS5DQtG6aPvoYtn7
Primary change type
Problem and motivation
Opening a project's Plan Agents session on
mainlaunches Claude Code with a replacement system prompt that says "Do not act as a coding or implementation agent. Do not scaffold agents, edit application source code, run implementation tasks, or deploy software." The session Studio puts the user into cannot build an agent, so the primary flow is dead until the planner profile is removed. Maintainer ruling: there is no special planning session type; a project session is an ordinary session that also has the map tools.Summary and scope
Stop-the-bleed. Nothing is redesigned.
src/server/index.ts: amap-plannersession uses the served prompt (loadSystemPrompt()with the sameDEFAULT_SYSTEM_PROMPTfallback) and appends the map context, instead of replacing the prompt withAGENT_MAP_PLANNER_SYSTEM_PROMPT. Appendix order: rehydration brief, map context, focused project context.src/profiles/agent-map-planner.ts: prohibition sentences removed. What remains names the three map tools (read, validate, propose), says to keep the map current when work changes the architecture, says to build directly when asked, and countermands the served prompt's mandatory first-reply orientation (the session already showed its own at SessionStart). The SessionStart copy no longer says "not to implement it yet". Export names unchanged.src/core/planning-session.ts,src/core/planner-greeting.ts: the non-Claude onboarding sentence and the greeting prompt say "plan and build" instead of "plan".agent-map-mcp-wiring.test.ts,claude-settings.test.ts); none deleted. The wiring stub now carries the orientation clause and asserts the override lands after it.Out of scope: removing the planner session type, routes, and client state. That is the follow-up PR on
gwitwer/no-planner-sessions, and Yash's #820/#826 stack deletes the planner wholesale; this PR keeps every export so that stack rebases cleanly.Restrictions searched for and what was done
profiles/agent-map-planner.tsprofiles/agent-map-planner.tsSessionStart copyprofiles/default.tsserved promptcore/planning-session.tsfocused contextcore/planning-session.tsnon-Claude onboardingcore/planner-greeting.tsgreeting promptagent-map,sapiom, andsapiom-dev; noallowedToolsordisallowedToolsinplanning-session.ts,planner-greeting.ts, or the serverBefore / after: generated
system-prompt.txtfor a planner sessionMeasured on a real server (
node dist/cli/bin.js <tree> --port 4131 --state-root <scratch>), reading<state-root>/generated/<session>/system-prompt.txtafterPOST /api/projects/:id/planner-sessions.Before (origin/main build, 1462 bytes, full file):
After (this branch at 984ae91, 6772 bytes, full file):
grep -c "Do not act as a coding\|Do not scaffold"on the after file: 0.Screenshot: Plan Agents session asked to scaffold
Playwright against the real server with
page.on("pageerror")attached (zero page errors). Prompt sent: "Scaffold a new agent in this project called hello-hotfix that just logs hello world. Do it now, locally only. Do not deploy and do not run anything remotely."The session scaffolded
hello-hotfix/throughsapiom-dev, typechecked it, ran the check step, did a stub Local Run, and the new agent appeared in the rail under the project. Nothing was deployed. Taken at b93a343, before the round-1 orientation override; the prompt text change since then is shown above.Related work
Related issue or discussion: SAP-3143. Superseded by Yash's #820 / #826 stack, which deletes the planner; this is the stopgap until that stack lands.
Validation
Tests and documentation
Tests re-pointed as described. Documentation: changeset only; no user docs describe the planning profile.
Compatibility and release impact
@sapiom/harnessminor.Security
will follow the
Security Policy for
private reporting.
AI assistance
Claude Code (Fable 5.1) wrote the change and tests under direction, ran the real-server verification, and drafted this body. Verified by the build, typecheck, test runs, mutation check, and the real-server prompt capture and screenshot above.
Checklist
CONTRIBUTING.md, and this contribution follows the direct-PR or issue-first policy.any N/A checks above.
did_not_work
agent_map_propose; the map pane still read "Nothing generated yet". Prompt guidance only, not enforced.pnpm testis not green on this machine even on unmodifiedorigin/main(13 watcher tests). Reported, not investigated here.server/index.tsandclaude-settings.test.ts, but both already failprettier --checkonorigin/main, so this PR does not reformat them.🤖 Generated with Claude Code
https://claude.ai/code/session_01DUq2aqxS5DQtG6aPvoYtn7