singularity-forge/src
Jeremy ad2211b218 fix(claude-code): wrap prompt history in XML tags to stop transcript fabrication
Closes #4102.

buildPromptFromContext previously serialized multi-turn history using
literal [User] / [Assistant] / [System] bracket labels. Those tokens
are the exact pattern the anti-fabrication rule in system.md and
discuss.md forbids — the model saw its own input framed as a bracket-
labeled transcript and mirrored the format in its output, inventing
both sides of the conversation during /gsd discuss turns.

Replace the bracket labels with XML-tag structure:
  - <conversation_history> wraps the whole turn sequence
  - <user_message> / <assistant_message> per turn
  - <prior_system_context> for the system prompt (renamed from
    <system_prompt> to avoid overlap with Claude Code's reserved
    <system-reminder> convention)

Prepend a directive telling the model to respond only to the final
user message and not emit the XML tags in its own response. Keep
system.md and discuss.md in sync by documenting that prior context
is delivered in those tags.

Add regression tests asserting:
  - no literal [User]/[Assistant]/[System] substrings in the prompt
  - history wrapped in <conversation_history> with per-turn tags
  - directive leads the prompt
  - empty-history edge cases still render correctly
2026-04-13 01:23:47 -05:00
..
resources fix(claude-code): wrap prompt history in XML tags to stop transcript fabrication 2026-04-13 01:23:47 -05:00
tests fix(mcp): expose every registered tool and fix SDK subpath resolution 2026-04-13 01:40:05 +00:00
web fix(windows): harden portability across runtime and tooling 2026-04-10 20:33:18 -05:00
app-paths.js
app-paths.ts
bundled-extension-paths.ts
bundled-resource-path.ts
claude-cli-check.ts fix(providers): route Anthropic subscription users through Claude Code CLI (#3772) 2026-04-08 07:20:20 -05:00
cli-web-branch.ts
cli.ts Merge pull request #4082 from jeremymcs/claude/review-mcp-server-tools-2Gchv 2026-04-12 20:54:51 -05:00
extension-discovery.ts
extension-registry.ts
headless-answers.ts
headless-context.ts
headless-events.ts fix(headless): keep idle timeout off during interactive tools 2026-04-12 14:04:15 +02:00
headless-query.ts fix(headless): sync resources and use agent dir for query 2026-04-05 11:35:11 -07:00
headless-types.ts test: Added --output-format text|json|stream-json flag, standardized ex… 2026-03-26 11:34:21 -06:00
headless-ui.ts feat: stream full text and thinking output in headless verbose mode (#2934) 2026-03-27 21:57:11 -06:00
headless.ts fix(headless): keep idle timeout off during interactive tools 2026-04-12 14:04:15 +02:00
help-text.ts docs: add provider setup guide for third-party LLM providers (#3294) 2026-04-05 00:48:19 -04:00
loader.ts fix(auto): resolve resource-loader.js from GSD_PKG_ROOT on resume (#3949) 2026-04-10 20:00:46 -05:00
logo.ts
mcp-server.ts fix(mcp): expose every registered tool and fix SDK subpath resolution 2026-04-13 01:40:05 +00:00
models-resolver.ts
onboarding.ts fix(providers): route Anthropic subscription users through Claude Code CLI (#3772) 2026-04-08 07:20:20 -05:00
pi-migration.ts
project-sessions.ts
provider-migrations.ts fix(cli): preserve anthropic api provider 2026-04-11 18:10:09 +02:00
remote-questions-config.ts chore: rename preferences.md to PREFERENCES.md for consistency (#2700) (#2738) 2026-03-26 16:09:59 -06:00
resource-loader.ts fix(cli): include all internal node_modules entries in pnpm merged dir 2026-04-12 02:12:13 -05:00
rtk.ts refactor(gsd): extract duplicated status guards and validation helpers (#2767) 2026-03-26 18:14:43 -06:00
security-overrides.ts fix(security): add configurable overrides for command allowlist and SSRF blocklist 2026-04-02 13:45:05 +02:00
startup-model-validation.ts fix(models): block unconfigured models from selection surfaces 2026-04-12 17:25:06 -05:00
startup-timings.ts
tool-bootstrap.ts
update-check.ts fix(update): fetch latest version from registry 2026-04-09 18:39:16 +02:00
update-cmd.ts fix(update): fetch latest version from registry 2026-04-09 18:39:16 +02:00
web-mode.ts fix(windows): harden portability across runtime and tooling 2026-04-10 20:33:18 -05:00
welcome-screen.ts fix(ui): remove 200-column cap on welcome screen width 2026-04-05 17:41:21 -05:00
wizard.ts fix(remote-questions): empty-key entry in auth.json shadows valid Discord bot token (#2737) 2026-03-26 16:16:42 -06:00
worktree-cli.ts
worktree-name-gen.ts