Skip to content

feat: define and persist native plan artifacts - #63

Closed
jefft72 wants to merge 2 commits into
mainfrom
stack/native-plan-01-persistence
Closed

jefft72 wants to merge 2 commits into
mainfrom
stack/native-plan-01-persistence

Conversation

@jefft72

@jefft72 jefft72 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Introduces native plans as a first-class coding-agent artifact with a bounded schema, normalized content, an intrinsic submit_plan tool, and an explicit implementation authorization prompt.
Extends append-only session history so collaboration mode, submitted plan drafts, user resolutions, and accepted implementation continuations survive JSONL reloads and branch replay.

Reasoning

Plan state must remain durable and branch-local because a user can resume, fork, compact, or navigate a session before deciding whether to implement a submitted plan.
Reconstructing that state from validated lifecycle entries prevents a plan from being lost, resolved against the wrong branch, or treated as implementation authority before the user explicitly accepts it.

Persisted artifacts also form a trust boundary.
Strict size, control-text, parentage, and transition checks keep malformed or tampered session data from silently changing collaboration policy or creating an ambiguous continuation.

Changes

  • Adds CollaborationMode, PlanArtifact, and PlanResolution contracts with limits for plan IDs, titles, and Markdown bodies.
  • Normalizes plan titles to a trimmed single line, preserves trimmed Markdown structure, rejects unsafe control and bidirectional text, and freezes parsed artifacts before use.
  • Adds the sequential intrinsic submit_plan tool with a typed input schema and a result that returns the exact persisted artifact.
  • Adds createPlanImplementationPrompt so accepted plans become an explicit, decision-ready implementation instruction instead of an implicit state change.
  • Extends session history with collaboration-mode, plan, and plan-resolution entries and exposes pending plan and continuation state through SessionContext.
  • Replays plan lifecycle state along each entry's parent chain, returns to default mode on resolution, and retains an implementation continuation only until its next user message consumes it.
  • Rejects invalid lifecycle transitions, mismatched resolutions, duplicate entry IDs, missing parents in plan-aware sessions, and invalid persisted plan artifacts before indexing the session.
  • Adds append APIs for each lifecycle entry and rolls back the in-memory entry list, index, and leaf when persistence fails.
  • Excludes plan lifecycle metadata from branch-summary conversation content while preserving the state needed for deterministic replay.
  • Covers tool normalization, unsafe text rejection, implementation prompts, JSONL round trips, malformed primitive lines, and duplicate-ID protection.

Testing

  • Final rebased stack: npm run check passed.
  • Final rebased stack: focused Vitest validation across 28 affected files passed all 451 tests.
  • This intermediate branch was not checked independently after reconstruction.

@jefft72
jefft72 requested review from Issacboy123 and Pepps233 and removed request for Issacboy123 and Pepps233 August 16, 2026 00:10
@Issacboy123
Issacboy123 force-pushed the stack/native-plan-01-persistence branch from ebb2a54 to 5483436 Compare August 16, 2026 03:14
Define validated plan artifacts and the intrinsic submit_plan tool so every runtime uses one normalized, bounded representation for planning output.
Persist collaboration mode, submitted plans, resolutions, and accepted continuations through validated append-only session history and branch replay.
@Pepps233
Pepps233 force-pushed the stack/native-plan-01-persistence branch from 5483436 to 6f036b1 Compare August 16, 2026 03:40
@Pepps233
Pepps233 changed the base branch from feat/task-profiles-28-resume-labels to main August 16, 2026 03:40
@jefft72

jefft72 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing to rebuild on a clean base.

This stack does not build. Two separate defects are present, and the first masks the second:

  1. A stray closing brace committed in feat: enforce native plan collaboration policy #64 stops packages/coding-agent/src/core/agent-session.ts from parsing at all.
  2. From feat: activate accepted plans in routed sessions #65 onward the stack imports five modules that exist only on the task profile stack: evolved.ts, harness-descriptors.ts, profile-router.ts, profiles.ts, and runtime-telemetry.ts.

Replacement stacks:

  • plan/* for native plan mode standing alone on main
  • plan-harness/* for the plan and profile integration

The branch behind this PR is retained unchanged as a backup.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant