Skip to content

FE-698: Prompt/context scenario substrate foundation#111

Open
lunelson wants to merge 1 commit into
mainfrom
ln/fe-698-slice-e
Open

FE-698: Prompt/context scenario substrate foundation#111
lunelson wants to merge 1 commit into
mainfrom
ln/fe-698-slice-e

Conversation

@lunelson
Copy link
Copy Markdown
Contributor

@lunelson lunelson commented May 8, 2026

Stack Context

This PR is the FE-698 prompt/context scenario substrate foundation. It makes prompt and context engineering explicit and testable before productizing more agent-heavy surfaces such as web research, candidate-spec assist, behavioral kernels, architect proposals, or post-spec decomposition probes.

What?

  • Adds a typed Brunch capability registry and includes capability metadata in prompt scenario artifacts.
  • Moves server role prompts into packaged markdown assets with golden coverage and build-boundary asset-copy tests.
  • Adds typed context packs for observer capture, web research, and candidate-spec scenarios.
  • Adds deterministic no-provider prompt scenario artifacts with prompt/context fingerprints and schema versioning.
  • Adds fakeable web-research scenario execution plus a probe-only Anthropic AI SDK adapter.
  • Hardens execution error serialization, prompt caching, typed scenario context data, and proposal-only candidate-spec authority.
  • Splits context-pack.ts into a public mini-library backed by private scenario-specific modules.

Why?

FE-698 is meant to prevent future agent features from each inventing their own prompt/context path. This PR establishes the shared substrate while keeping provider credential UX, production provider routing, UI, persistence, Pi integration, and durable Brunch mutations out of scope.

Candidate-spec and other generative scenario outputs are intentionally review/probe artifacts, not accepted graph truth. Future agent-originated writes should go through Brunch-owned mutation handlers / changeset surfaces rather than direct ORM or ad hoc tool calls.

Verification

  • npm run verify

@lunelson lunelson force-pushed the ln/fe-698-slice-d branch from 3fef067 to e431537 Compare May 8, 2026 11:02
@lunelson lunelson force-pushed the ln/fe-698-slice-e branch from 01453e6 to b4fa6b9 Compare May 8, 2026 11:02
@graphite-app graphite-app Bot changed the base branch from ln/fe-698-slice-d to graphite-base/111 May 8, 2026 11:04
@lunelson lunelson force-pushed the ln/fe-698-slice-e branch from b4fa6b9 to ec24cc4 Compare May 8, 2026 12:42
@lunelson lunelson force-pushed the graphite-base/111 branch from e431537 to 9400c1e Compare May 8, 2026 12:42
@lunelson lunelson changed the base branch from graphite-base/111 to main May 8, 2026 12:42
@lunelson lunelson changed the title FE-698 add capability registry metadata FE-698: Prompt/context scenario substrate foundation May 8, 2026
@lunelson lunelson marked this pull request as ready for review May 8, 2026 13:22
@cursor
Copy link
Copy Markdown

cursor Bot commented May 8, 2026

PR Summary

Medium Risk
Medium risk because it introduces new server-side prompt/context-pack and scenario-runner plumbing (including build/test asset copying and execution adapters) that could affect probe tooling and future agent integrations, though it largely stays in non-user-facing harness paths.

Overview
Establishes a typed prompt/context scenario substrate on the server: adds a capability contract registry (authority-tagged operation ids) and records validated capability metadata in prompt-scenario probe artifacts.

Expands the scenario runner from observer-capture to also cover web-research and candidate-spec, including new typed context packs, packaged markdown system prompts, schema v2 artifacts with deterministic prompt/context sha256 fingerprints, and stricter type boundaries around scenario definitions.

Adds a probe-only execution path for web-research scenarios via an injected model adapter (plus an Anthropic AI SDK adapter), with hardened failure serialization (API-key-like redaction, non-Error rejection handling). Also refactors context-pack.ts into a public entry point backed by per-scenario private modules, adds golden snapshot coverage for production prompts, improves prompt-asset caching for empty files, and updates a graph-view test to mock the new annotation API call.

Reviewed by Cursor Bugbot for commit 0fb5687. Bugbot is set up for automated code reviews on this repo. Configure here.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 8, 2026

🤖 Augment PR Summary

Summary: Establishes the FE-698 “prompt/context scenario substrate” foundation so prompt + context engineering becomes explicit, typed, and probeable before broader agent-heavy productization.

Changes:

  • Introduces a typed capability registry with stable ids + authority metadata, and validates scenario capability references.
  • Refactors context-pack.ts into a public entry point with scenario-specific private modules (observer-capture, web-research, candidate-spec).
  • Adds typed context packs + deterministic renderers for candidate-spec and web-research scenarios.
  • Extends the scenario runner to support multiple scenario kinds, schema versioning (v2), and prompt/context SHA-256 fingerprints.
  • Adds web-research scenario execution via an injected model-adapter seam plus a probe-only Anthropic AI SDK adapter.
  • Hardens execution error serialization with deterministic summaries and redaction of API-key-like strings.
  • Moves/expands server prompts into packaged markdown assets and adds golden snapshot coverage for rendered production prompts.
  • Updates build-boundary behavior to mirror prompt assets cleanly (removing stale destination files) and tests it using an isolated output directory.

Technical Notes: Scenarios intentionally remain “probe/review artifacts” (proposal-only / not durable truth), while capability metadata and prompt asset provenance are captured to keep future agent surfaces consistent.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2fd4282. Configure here.

Comment thread src/server/context-pack/candidate-spec.ts
@lunelson lunelson force-pushed the ln/fe-698-slice-e branch from 99cc970 to 0fb5687 Compare May 11, 2026 16:17
Copy link
Copy Markdown
Contributor

@kostandinang kostandinang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the failing test

Comment thread memory/PLAN.md
- [2026-05-07] FE-698 prompt/context foundation slices — Packaged markdown prompt registry + observer and web-research context-pack foundations + scenario runner capture skeleton/composition + agent mutation-surface audit + capability registry metadata. Server interviewer, observer, side-chat, and web-research role prompts now load from markdown assets through a typed prompt registry; observer capture and web-research probes render typed scenario-specific context packs; seeded prompt scenarios compose production prompts with typed context-pack output into deterministic no-provider probe artifacts; and scenario artifacts can declare validated Brunch capability contracts. Review fixes moved observer prompt composition into a pure module and made prompt scenario prompt sources explicit. The agent mutation-surface audit inventories current and projected agent-originated write paths as input to later handler slices. Verified: `npm run verify` for code slices; audit verified by code-search/document consistency. This is a completed foundation within FE-698, not retirement of the whole FE-698 frontier; the live continuation remains in `Next`.
- [2026-05-07] Side-chat V2 — Edit / Drill-down / Propose-edge plumbing (FE-673, PR #97) — added `edit`, `edge`, and `drill-down` patch kinds. Server `classifyEditImpact` returns `none | soft | hard`; soft applies directly with undo, hard returns `deferred: true` placeholder. Client: patch-list reducer + three applier factories with real undo handlers. Verified: `npm run verify` (935 tests, 19 new). Watch: `SideChatPopover` Edit button stays `disabled` and hard-impact deferred banner is live until V3.0 lands.
- [2026-05-06] Multi-chat substrate + reconciliation needs (FE-697) — `chat` table with one interview chat per spec, nullable `turn.chat_id`, `specification.primary_chat_id`, mirrored `chat.active_turn_id`, plus the `reconciliation_need` queue with directed source/target items, narrow `kind`/`status`, partial unique index on open rows, cascade FK. Spec creation inserts spec + interview chat in one transaction; `advanceHead` is transactional. No user-visible change. Verified: `npm run verify` (673 tests) plus manual fixture playback (39 specs / 81 turns / dual-pointer equivalence). A82 / A83 validated for Phase 1.
- [2026-05-01] Side-chat V1.1 — Explore vertical slice. End-to-end graph-launched chat interaction shipped: prompt builder, POST `/side-chat` SSE endpoint, popover host, graph-view wiring, SSE consumer, and active-button activation. Follow-up refactor collapsed pending assistant text into the message list and extracted `SideChatHost` so activation is a tree-mount fact. This is complete implementation history; future conceptual work is multi-chat / reconciliation, not Side-chat V2/V3.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side-chat V1.1 appears twice like a duplicate paste; worth deleting one so history stays single-source.

mkdirSync(sourceDir);
mkdirSync(destinationDir);

copyServerPromptAssets(sourceDir, destinationDir);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports copyServerPromptAssets from ../../vite.config.js, but neither vite.config.ts nor
config/vite-server-runtime.ts exports such a symbol.

Seeing

TypeError: copyServerPromptAssets is not a function
 src/server/prompt-build-boundary.test.ts:20:5
18|     mkdirSync(destinationDir);
19|
20|     copyServerPromptAssets(sourceDir, destinationDir);
|     ^
21|     writeFileSync(join(destinationDir, '[stale-prompt.md](http://stale-prompt.md)'), 'removed');
22|     writeFileSync(join(sourceDir, '[current-prompt.md](http://current-prompt.md)'), 'current');  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants