Skip to content

refactor(core): rename system context to instructions - #35583

Merged
kitlangton merged 1 commit into
v2from
instruction-rename-only
Jul 6, 2026
Merged

kitlangton merged 1 commit into
v2from
instruction-rename-only

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Pure vocabulary and contract rename — behavior is unchanged. The durable path-local discovery redesign that previously traveled with this rename is split into the stacked follow-up PR based on this branch.

What renames

  • Modules: the SystemContext algebra becomes Instructions (packages/core/src/instructions), with InstructionBuiltIns, InstructionDiscovery (formerly InstructionContext), InstructionEntry (formerly SessionContextEntry), and InstructionCheckpoint (formerly SessionContextCheckpoint). The SessionInstructions synthetic injection mechanism is untouched.
  • Tables: session_context_entry -> instruction_entry, session_context_epoch -> instruction_checkpoint (also fixing the old epoch/checkpoint name mismatch). The migration renames in place.
  • Events: session.context.updated -> session.instructions.updated; the migration rewrites existing durable event types in place, preserving history.
  • Routes: API-managed entry CRUD moves from /api/session/:sessionID/context-entry to /api/session/:sessionID/instructions/entries[/:key] with session.instructions.entry.* operation ids, keeping bare session.instructions.* free for the composed instruction surface. httpapi-codegen learns nested client paths so clients expose session.instructions.entry.list/put/remove.
  • Vocabulary: CONTEXT.md now separates Model Context (everything assembled for one Step) from Instructions (one component of it), removing the old collision with "context window". AGENTS.md and specs follow.

Verification

  • bun typecheck clean in core, protocol, server, client, codemode, sdk-next, schema, httpapi-codegen.
  • Test suites green: core (instructions algebra, discovery, synthetic injection, runner, projector, prompt, compaction, tool-read, migrations, events), schema manifest, protocol, client, codemode, httpapi-codegen, sdk-next.
  • bun script/migration.ts --check passes; clients, SDK types, and the codemode fixture regenerate cleanly with rename-only diffs.
  • Pre-existing and unrelated: client contract-identity.test.ts module resolution and schema v1-isolation (filesystem-v1.ts) failures reproduce on the base branch.

Pure vocabulary and contract rename; behavior is unchanged.

- Rename the SystemContext algebra to Instructions and move it to
  src/instructions, with InstructionBuiltIns, InstructionDiscovery
  (formerly InstructionContext), InstructionEntry, and
  InstructionCheckpoint replacing the context-named modules.
- Rename tables session_context_entry and session_context_epoch to
  instruction_entry and instruction_checkpoint; the migration renames
  in place and rewrites durable session.context.updated event types to
  session.instructions.updated.
- Nest API-managed entry routes under
  /api/session/:sessionID/instructions/entries with
  session.instructions.entry.* operation ids, keeping bare
  session.instructions.* free for the composed instruction surface.
- Teach httpapi-codegen nested client paths so generated clients expose
  session.instructions.entry.list/put/remove.
- Separate Model Context from Instructions in CONTEXT.md and update
  specs; regenerate clients, SDK types, and the codemode fixture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant