Skip to content

Add Todo discussion planning and Goal handoff - #8

Merged
boh5 merged 4 commits into
mainfrom
codex/todo-discussion-plan-goal
Jul 31, 2026
Merged

Add Todo discussion planning and Goal handoff#8
boh5 merged 4 commits into
mainfrom
codex/todo-discussion-plan-goal

Conversation

@boh5

@boh5 boh5 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • introduce discussion as a dedicated root Agent identity for shaping a bound Todo without starting implementation
  • add the single-file Plan workflow under .archcode/plans/<todo-id>.md, including plan-work and execute-plan Skills
  • add the fixed Generate / Improve Plan Todo action, grouped drawer actions, pointer-first drag targeting, and resilient handling for busy or stale Discussions
  • keep Start Work and Goal orthogonal: a Plan changes the initial Lead handoff, while Goal creation remains an explicit user choice
  • update runtime boundaries, server mappings, Web behavior, design specifications, architecture documentation, and regression coverage

Why

Todo, Plan, and Goal previously lacked a clear product and runtime boundary. This change makes Discussion a formal identity, keeps Plan as ordinary Markdown, and reuses the existing Lead/Goal execution protocol without adding a Plan service, state machine, compatibility layer, or automatic Goal creation.

Validation

  • bun run typecheck
  • bun run test
  • bun run build
  • git diff --check
  • production Web source CJK scan
  • real browser QA for Plan creation/improvement, busy Discussion handling, Start Work with and without Goal, action grouping, and narrow-screen Todo dragging
  • independent sol(xhigh) architecture review: approved

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added Discussion Sessions for shaping Todos and creating Markdown Plans.
    • Added Plan generation, improvement, execution handoff, and optional Goal creation workflows.
    • Added model overrides for user-facing Lead and Discussion Sessions.
    • Added responsive Todo actions, improved drag targeting, session reuse, and fallback handling.
  • Bug Fixes

    • Improved conflict error responses with clearer details and metadata.
    • Preserved multiline slash-command arguments.
    • Moved live attention notices to a more visible position.
    • Replaced untranslated artifact controls with “View output” and “Hide output.”

Introduce the dedicated Discussion agent and Plan workflow skills. Route Todo planning and Start Work handoff through durable Sessions while keeping Goal optional, and cover the behavior across runtime, server, Web, architecture tests, and documentation.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@boh5, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f083c1f3-a5e1-43a1-b723-b181ebcc8bc5

📥 Commits

Reviewing files that changed from the base of the PR and between 8dc4c9c and c0b8b32.

📒 Files selected for processing (1)
  • packages/agent-core/src/execution/session-cwd-reference-migration.integration.test.ts
📝 Walkthrough

Walkthrough

Changes

Discussion agent and session identity

Layer / File(s) Summary
Discussion agent definition and identity rules
packages/agent-core/src/agents/..., packages/agent-core/src/prompt/..., packages/agent-core/src/store/...
Adds the discussion agent, its role contract, delegation limits, skills, and root-session identity validation.
Runtime and model-selection integration
packages/agent-core/src/runtime.ts, packages/agent-core/src/session-input/..., packages/agent-core/src/execution/...
Allows Lead or Discussion user-facing roots and removes legacy Lead-based Discussion checks.
Todo Plan session flow
packages/agent-core/src/todos/..., packages/agent-core/src/skills/builtin/..., packages/protocol/src/...
Adds initialIntent: "plan", Plan-aware messages, execute-plan, and Discussion authorization rules.

Todo board and feedback behavior

Layer / File(s) Summary
Plan actions and drag targeting
apps/web/src/routes/project-todos.tsx, apps/web/src/routes/project-todos.test.tsx, apps/web/src/routes/project-todos.interaction.tsx
Adds Plan generation orchestration, Discussion reuse or creation, conflict fallback, grouped drawer actions, and pointer-based lane targeting.
HITL notice placement
apps/web/src/routes/root-layout.tsx, apps/web/src/routes/root-layout.interaction.tsx
Moves live HITL notices to the top-right below the toolbar and adds placement coverage.
HTTP conflict mapping
apps/server/src/routes/messages.ts, apps/server/src/routes/messages.test.ts
Maps session, command, steering, stop, and tool-batch conflicts to structured HTTP 409 responses with relevant metadata.

Documentation and validation

Layer / File(s) Summary
Product and architecture documentation
AGENTS.md, README.md, docs/..., design-system/...
Documents the Discussion identity, Todo Plan lifecycle, session rules, UI actions, and notice placement.
Integration and contract tests
packages/agent-core/src/**/*.test.ts, apps/server/src/routes/*.test.ts, apps/web/src/**/*.test.*
Updates agent, session, Todo, Plan, model-selection, command, API, and browser interaction coverage.

Possibly related PRs

  • boh5/archcode#5: Both changes modify apps/web/src/routes/project-todos.tsx and its tests. This PR adds Todo planning orchestration, while that PR adds sidebar toggle UI.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.39% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the PR's primary changes: Todo Discussion planning and Goal handoff.
Description check ✅ Passed The description includes a clear summary, rationale, validation steps, documentation updates, and regression coverage; only template checklist details are omitted.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 79 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/agent-core/src/prompt/lint.ts
Comment thread docs/goals/todo-discussion-plan-execution-hard-cut-plan-goal.md
Comment thread docs/goals/todo-discussion-plan-execution-hard-cut-plan-goal.md Outdated
Comment thread packages/protocol/src/project-todos.ts Outdated
Comment thread packages/agent-core/src/agents/definitions/role-contracts.ts Outdated
Comment thread apps/web/src/routes/project-todos.interaction.tsx
Comment thread packages/agent-core/src/todos/service.ts
Comment thread packages/agent-core/src/agents/root-session-identity.ts Outdated
Comment thread apps/web/src/routes/project-todos.tsx Outdated
Comment thread apps/web/src/routes/project-todos.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
apps/web/src/routes/project-todos.tsx (1)

97-99: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Share the plan command string instead of duplicating it.

planWorkCommand restates the exact command that sessionMessage builds in packages/agent-core/src/todos/service.ts (lines 145-180), and it hardcodes .archcode/plans/ while the server derives the path from PROJECT_STATE_DIR_NAME. If either the wording or the state directory changes, the reused-Discussion path and the new-Discussion path diverge silently. Move the command builder and the plans path into @archcode/protocol and consume it from both sides.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/routes/project-todos.tsx` around lines 97 - 99, Move the shared
plan-work command builder and plans-directory path constant into
`@archcode/protocol`, then update planWorkCommand in project-todos.tsx and
sessionMessage in the todos service to consume them. Remove the duplicated
command wording and hardcoded .archcode/plans/ path while preserving the
existing todoId substitution and behavior.
packages/agent-core/src/todos/schema.ts (2)

14-27: 📐 Maintainability & Code Quality | 🔵 Trivial

Canonical schema duplicated in apps/server/src/routes/todos.ts.

CreateProjectTodoSessionSchema here is the schema the service actually parses against. apps/server/src/routes/todos.ts redefines an identical schema and superRefine rule. See the consolidated comment for the shared fix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/agent-core/src/todos/schema.ts` around lines 14 - 27, Use the
canonical CreateProjectTodoSessionSchema from packages/agent-core instead of
maintaining a duplicate definition in apps/server/src/routes/todos.ts. Remove
the route-local schema and its superRefine rule, then import and reuse the
shared schema so parsing and validation remain identical.

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate initialIntent/entry validation rule across the HTTP and service layers. Both files define the same fields, the same z.literal("plan").optional() constraint, and the identical superRefine message restricting initialIntent to Discussion Sessions. The rule is defined twice instead of shared, risking drift if one copy changes without the other.

  • packages/agent-core/src/todos/schema.ts#L14-27: keep this as the single source of truth; export CreateProjectTodoSessionSchema (or its shape) from the package's public surface.
  • apps/server/src/routes/todos.ts#L47-59: replace the locally redefined CreateProjectTodoSessionBodySchema with an import of the schema from packages/agent-core/src/todos/schema.ts, instead of re-declaring the same fields and superRefine rule.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/agent-core/src/todos/schema.ts` at line 1, Make the todo session
validation in packages/agent-core/src/todos/schema.ts the single source of truth
by exporting CreateProjectTodoSessionSchema or its shape through the package’s
public API. In the server route’s CreateProjectTodoSessionBodySchema usage,
import and reuse that exported schema instead of locally redefining the fields
and superRefine rule, preserving the existing validation behavior.
apps/server/src/routes/todos.ts (1)

47-59: 📐 Maintainability & Code Quality | 🔵 Trivial

Duplicate validation logic with packages/agent-core/src/todos/schema.ts.

This schema repeats the same entry/initialIntent shape and superRefine rule, including the exact error message, that CreateProjectTodoSessionSchema in packages/agent-core/src/todos/schema.ts already defines. See the consolidated comment for the shared fix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server/src/routes/todos.ts` around lines 47 - 59, Replace the locally
defined CreateProjectTodoSessionBodySchema validation in the todos route with
the shared CreateProjectTodoSessionSchema from
packages/agent-core/src/todos/schema.ts, reusing its entry/initialIntent shape
and refinement instead of duplicating the rule. Preserve the route’s
expectedRevision validation and existing request parsing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 460-462: Update the Plan-generation documentation in AGENTS.md
lines 460-462 and docs/concepts.md lines 55-62 to specify that the latest
Discussion is reused only when idle; running, HITL-suspended, deleted, or newly
busy Sessions require creating a new Plan Discussion. Preserve the rule that a
newly created Discussion receives the Plan request as its first accepted message
and that generation uses the single deterministic .archcode/plans/<todo-id>.md
path.

In `@apps/web/src/routes/project-todos.tsx`:
- Around line 149-155: Update isUnavailablePlanDiscussion so the 404 fallback
returns true only when cause.code equals "SESSION_NOT_FOUND"; preserve the
existing 409 scopeCode handling. Update the stale-session test to use
SESSION_NOT_FOUND rather than treating every 404 as an unavailable plan
discussion.

In `@packages/agent-core/src/store/session-store-manager.ts`:
- Around line 203-211: Strengthen session identity validation so non-root agents
require a parentSessionId and child sessions cannot provide their own
rootSessionId. Apply the same checks in session-store-manager.ts at the session
creation guard and helpers.ts during persisted Session validation, then add
tests covering both invalid combinations.

---

Nitpick comments:
In `@apps/server/src/routes/todos.ts`:
- Around line 47-59: Replace the locally defined
CreateProjectTodoSessionBodySchema validation in the todos route with the shared
CreateProjectTodoSessionSchema from packages/agent-core/src/todos/schema.ts,
reusing its entry/initialIntent shape and refinement instead of duplicating the
rule. Preserve the route’s expectedRevision validation and existing request
parsing behavior.

In `@apps/web/src/routes/project-todos.tsx`:
- Around line 97-99: Move the shared plan-work command builder and
plans-directory path constant into `@archcode/protocol`, then update
planWorkCommand in project-todos.tsx and sessionMessage in the todos service to
consume them. Remove the duplicated command wording and hardcoded
.archcode/plans/ path while preserving the existing todoId substitution and
behavior.

In `@packages/agent-core/src/todos/schema.ts`:
- Around line 14-27: Use the canonical CreateProjectTodoSessionSchema from
packages/agent-core instead of maintaining a duplicate definition in
apps/server/src/routes/todos.ts. Remove the route-local schema and its
superRefine rule, then import and reuse the shared schema so parsing and
validation remain identical.
- Line 1: Make the todo session validation in
packages/agent-core/src/todos/schema.ts the single source of truth by exporting
CreateProjectTodoSessionSchema or its shape through the package’s public API. In
the server route’s CreateProjectTodoSessionBodySchema usage, import and reuse
that exported schema instead of locally redefining the fields and superRefine
rule, preserving the existing validation behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ee6911ad-624b-408c-b9e9-8394feb21df2

📥 Commits

Reviewing files that changed from the base of the PR and between f3acd91 and f6c6027.

📒 Files selected for processing (79)
  • AGENTS.md
  • README.md
  • apps/server/src/routes/attachment-http-error.ts
  • apps/server/src/routes/messages.test.ts
  • apps/server/src/routes/messages.ts
  • apps/server/src/routes/sessions.test.ts
  • apps/server/src/routes/todos.test.ts
  • apps/server/src/routes/todos.ts
  • apps/web/src/components/composite/ToolCard.test.tsx
  • apps/web/src/components/composite/ToolCard.tsx
  • apps/web/src/lib/agent-constants.test.ts
  • apps/web/src/lib/agent-constants.ts
  • apps/web/src/routes/project-todos.interaction.tsx
  • apps/web/src/routes/project-todos.test.tsx
  • apps/web/src/routes/project-todos.tsx
  • apps/web/src/routes/root-layout.interaction.tsx
  • apps/web/src/routes/root-layout.tsx
  • design-system/MASTER.md
  • design-system/pages/todos.md
  • design-system/prototypes/todos.html
  • docs/agents/multi-agent-design.md
  • docs/concepts.md
  • docs/configuration.md
  • docs/goals/todo-discussion-plan-execution-hard-cut-plan-goal.md
  • docs/goals/todo-discussion-plan-execution-hard-cut-progress.md
  • packages/agent-core/src/__arch__/goal-boundaries.test.ts
  • packages/agent-core/src/__arch__/tool-output-policy-matrix.test.ts
  • packages/agent-core/src/agents/configured-agent.test.ts
  • packages/agent-core/src/agents/configured-agent.ts
  • packages/agent-core/src/agents/definitions/definitions.test.ts
  • packages/agent-core/src/agents/definitions/discussion.ts
  • packages/agent-core/src/agents/definitions/index.ts
  • packages/agent-core/src/agents/definitions/lead.ts
  • packages/agent-core/src/agents/definitions/role-contracts.ts
  • packages/agent-core/src/agents/errors.ts
  • packages/agent-core/src/agents/factory.test.ts
  • packages/agent-core/src/agents/index.ts
  • packages/agent-core/src/agents/names.ts
  • packages/agent-core/src/agents/root-session-identity.ts
  • packages/agent-core/src/agents/session-profile.ts
  • packages/agent-core/src/commands/registry.test.ts
  • packages/agent-core/src/commands/registry.ts
  • packages/agent-core/src/delegation/contract.test.ts
  • packages/agent-core/src/execution/session-execution-manager.test.ts
  • packages/agent-core/src/execution/session-execution-manager.ts
  • packages/agent-core/src/lead-architecture-flows.integration.test.ts
  • packages/agent-core/src/main.test.ts
  • packages/agent-core/src/prompt/compiler.test.ts
  • packages/agent-core/src/prompt/lint.ts
  • packages/agent-core/src/runtime-automations.test.ts
  • packages/agent-core/src/runtime.ts
  • packages/agent-core/src/session-goal/service.test.ts
  • packages/agent-core/src/session-input/model-selection-service.ts
  • packages/agent-core/src/session-input/model-selection.test.ts
  • packages/agent-core/src/skills/builtin/execute-plan/SKILL.md
  • packages/agent-core/src/skills/builtin/manifest.ts
  • packages/agent-core/src/skills/builtin/plan-work/SKILL.md
  • packages/agent-core/src/skills/builtin/shape-todo/SKILL.md
  • packages/agent-core/src/skills/service.test.ts
  • packages/agent-core/src/skills/service.ts
  • packages/agent-core/src/store/helpers.test.ts
  • packages/agent-core/src/store/helpers.ts
  • packages/agent-core/src/store/session-store-manager.test.ts
  • packages/agent-core/src/store/session-store-manager.ts
  • packages/agent-core/src/store/types.ts
  • packages/agent-core/src/todos/schema.ts
  • packages/agent-core/src/todos/service.test.ts
  • packages/agent-core/src/todos/service.ts
  • packages/agent-core/src/tools/builtins/automation-create.test.ts
  • packages/agent-core/src/tools/builtins/automation-create.ts
  • packages/agent-core/src/tools/builtins/model-visible-contract.test.ts
  • packages/agent-core/src/tools/builtins/project-todo-update.test.ts
  • packages/agent-core/src/tools/builtins/project-todo-update.ts
  • packages/agent-core/src/tools/builtins/session-goal.test.ts
  • packages/agent-core/src/tools/builtins/session-goal.ts
  • packages/agent-core/src/tools/builtins/worktree.ts
  • packages/protocol/src/model-runtime.ts
  • packages/protocol/src/project-todos.ts
  • packages/protocol/src/types.ts
💤 Files with no reviewable changes (2)
  • packages/agent-core/src/tools/builtins/session-goal.ts
  • packages/agent-core/src/tools/builtins/worktree.ts

Comment thread AGENTS.md Outdated
Comment thread apps/web/src/routes/project-todos.tsx
Comment thread packages/agent-core/src/store/session-store-manager.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 23 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/protocol/src/project-todos.ts Outdated
@boh5
boh5 merged commit 3dd05f7 into main Jul 31, 2026
7 checks passed
@boh5
boh5 deleted the codex/todo-discussion-plan-goal branch July 31, 2026 05:12
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.

1 participant