Просмотр исходного кода

chore: remove docs/plans from tracking and gitignore

These are local design/planning documents that shouldn't be in the
repository. Untrack the 8 files merged from dev and add docs/plans/
to .gitignore.
Ma 7 месяцев назад
Родитель
Сommit
2ec8b66e78

+ 1 - 0
.gitignore

@@ -23,3 +23,4 @@ autoresearch/
 .playwright-cli/
 .superpowers/
 _*.md
+docs/plans/

+ 0 - 559
docs/plans/2026-04-06-interaction-control-layer-design.md

@@ -1,559 +0,0 @@
-# Interaction Control Layer Design
-
-## Goal
-
-Build a shared interaction control layer for InkOS so that `TUI` and `Studio` stop acting like separate products and instead become two shells over the same writing control brain.
-
-This layer must let users:
-- create a book through natural conversation
-- continue an active book inside a project workspace
-- see exactly what the system is doing right now
-- intervene safely on chapters, truth files, and direction
-- choose how much autonomy the system has
-
-## Why This Exists
-
-Current InkOS has strong execution primitives but weak control ergonomics.
-
-Today the user experience is split across:
-- CLI commands
-- Studio buttons and pages
-- a shallow `/api/agent` chat box
-- daemon logs
-- direct truth-file editing
-
-That produces the exact failures users complain about:
-- the system keeps writing when the user expected it to stop
-- the user cannot tell what stage the system is in
-- edits to truth files do not feel authoritative
-- rejecting or revising a chapter does not feel like part of one coherent flow
-- Studio chat does not hold enough session context to feel like a real assistant
-
-The solution is not “more buttons” and not “just add a TUI”. The solution is a single interaction control layer that owns:
-- session context
-- book binding
-- autonomy policy
-- natural-language intent routing
-- execution status
-- human edit transactions
-
-## Product Principles
-
-### 1. Project-first
-
-InkOS should behave like a writing version of Coding CLI.
-
-The user opens a project directory and runs:
-
-```bash
-inkos
-```
-
-The current working directory is the project context. The control layer restores:
-- project config
-- books in the project
-- active book, if one exists
-- current running task, if one exists
-
-The user should not be thrown into a global dashboard first.
-
-### 2. Conversation-first, not form-first
-
-When there is no active task, the interface should be quiet.
-
-It should not dump a questionnaire. It should wait for the user to speak first. The system then gradually narrows the task by asking only the most important next question.
-
-Bad:
-- “Choose language / genre / length / mode / trend scanning / source mode”
-
-Good:
-- user: “I want to write a cold urban mystery”
-- system: “I’ll hold it as a cold urban mystery. Do you want something long-running, or something that can close within about 10-20 chapters?”
-
-### 3. Status must stay visible at all times
-
-The user must always be able to answer:
-- which book is active?
-- what chapter is being worked on?
-- which stage is running right now?
-- why is the system waiting or blocked?
-
-### 4. Human edits are transactions, not raw file writes
-
-Users must be able to change:
-- a person name
-- a chapter
-- a paragraph
-- `current_focus`
-- `author_intent`
-- truth files
-
-But these changes cannot be “write to one file and hope the rest follows”. The control layer must route human edits through a consistency-preserving edit controller.
-
-### 5. TUI and Studio share the same brain
-
-`TUI` and `Studio` may have different layouts, but they must share:
-- session model
-- intent routing
-- autonomy policy
-- control actions
-- execution status
-- pending decisions
-
-No duplicate business logic in both shells.
-
-## User Journeys
-
-### Journey A: New book from a vague idea
-
-1. User runs `inkos` inside a project.
-2. No active book exists.
-3. User types: “I want to write a quiet harbor mystery.”
-4. The control layer opens a book-creation conversation.
-5. Through a few turns, the system gathers enough intent to draft:
-   - title direction
-   - genre
-   - target scale
-   - language
-   - source mode: original / continuation / fanfic
-   - autonomy preference
-6. System proposes a structured book draft.
-7. User confirms or adjusts.
-8. System runs foundation generation.
-9. If the autonomy policy allows, it proceeds into writing; otherwise it waits for outline review.
-
-### Journey B: Continue an active book
-
-1. User runs `inkos` in a project that already has books.
-2. The control layer restores the active book.
-3. The interface opens on that book’s current session.
-4. User types “continue”.
-5. Control layer maps that to `write_next`.
-6. Status stream shows:
-   - planning
-   - composing
-   - writing
-   - assessing
-   - repairing
-   - persisting
-7. If a stop condition is met, the task switches to `waiting_human`.
-
-### Journey C: Intervene on a chapter
-
-1. User types: “Rewrite chapter 3, but keep the ending reveal.”
-2. Control layer identifies:
-   - action: `rewrite_chapter`
-   - chapter: `3`
-   - constraint: keep ending reveal
-3. It builds an edit transaction.
-4. Runtime executes rewrite + reanalysis + truth/state rebuild for affected scope.
-5. User sees diff, updated status, and any downstream invalidations.
-
-### Journey D: Fix authority confusion
-
-1. User types: “Why is the protagonist still called Lu Chen?”
-2. Control layer resolves authoritative sources:
-   - story bible
-   - current state
-   - book rules
-   - recent chapters
-   - active entity state
-3. It explains which source currently wins.
-4. User can then say:
-   - “Rename the protagonist to Lin Yan everywhere”
-5. Control layer opens an entity-level rename transaction instead of editing random files manually.
-
-## Architecture
-
-There should be one new subsystem spanning `core`, `cli`, and `studio`.
-
-### Layer 1: Interaction Core
-
-New `core` module family that owns conversation state and intent routing.
-
-Responsibilities:
-- maintain `InteractionSession`
-- bind current project and active book
-- classify user messages into intent types
-- ask follow-up questions when required
-- emit structured requests for execution
-
-This layer does not directly run writing logic.
-
-### Layer 2: Control Runtime
-
-Execution orchestrator for interaction requests.
-
-Responsibilities:
-- turn a request into an executable action plan
-- call existing pipeline capabilities
-- track stage transitions
-- publish execution events
-- manage waiting-human transitions
-
-This layer is the bridge between conversation and pipeline.
-
-### Layer 3: Execution Substrate
-
-Existing InkOS capabilities remain underneath:
-- `PipelineRunner`
-- `writer`
-- `review`
-- `repair-state`
-- truth file read/write
-- `scheduler`
-
-This design avoids rewriting the execution engine from scratch.
-
-### Layer 4: Shells
-
-Two shells sit above the same control layer:
-- `TUI`
-- `Studio`
-
-Both subscribe to the same session and status model.
-
-## Core Objects
-
-### `InteractionSession`
-
-Represents one project-scoped working conversation.
-
-Fields:
-- `sessionId`
-- `projectRoot`
-- `activeBookId?`
-- `activeChapterNumber?`
-- `messages`
-- `automationMode`
-- `pendingDecision?`
-- `currentExecution?`
-- `lastResolvedIntent?`
-
-### `AutomationMode`
-
-Three explicit modes:
-- `auto`
-- `semi`
-- `manual`
-
-Meaning:
-- `auto`: continue chapters automatically unless a true hard stop occurs
-- `semi`: user starts each chapter; chapter-internal loop stays automatic
-- `manual`: no autonomous progression; only explicit user commands run
-
-### `InteractionIntent`
-
-Normalized intent categories:
-- `create_book`
-- `select_book`
-- `continue_book`
-- `write_next`
-- `pause_book`
-- `resume_book`
-- `revise_chapter`
-- `rewrite_chapter`
-- `edit_truth`
-- `update_focus`
-- `update_author_intent`
-- `explain_status`
-- `explain_failure`
-- `export_book`
-- `switch_mode`
-
-### `InterventionRequest`
-
-The structured handoff from interaction core to runtime.
-
-Fields:
-- `intent`
-- `bookId`
-- `chapterNumber?`
-- `instruction?`
-- `truthFile?`
-- `modeOverride?`
-- `constraints`
-
-### `ExecutionStatus`
-
-Normalized, shell-friendly runtime state:
-- `idle`
-- `planning`
-- `composing`
-- `writing`
-- `assessing`
-- `repairing`
-- `persisting`
-- `waiting_human`
-- `blocked`
-- `completed`
-- `failed`
-
-### `PendingDecision`
-
-Represents a human decision that must be surfaced clearly.
-
-Examples:
-- approve current chapter before continuing
-- choose whether to rewrite or keep a chapter
-- resolve a truth authority conflict
-- confirm a project-level change
-
-## Edit Controller
-
-This is required. Without it, human intervention will keep poisoning consistency.
-
-### Why It Exists
-
-Users need to change:
-- names
-- chapters
-- paragraphs
-- direction
-- truth files
-
-Those changes can affect:
-- chapter text
-- current state
-- hook state
-- chapter summaries
-- future chapter assumptions
-
-So edits must be transactional.
-
-### Edit Types
-
-#### 1. Entity edits
-
-Examples:
-- rename protagonist
-- change a character attribute
-
-These are not text replacements. They must update the authoritative entity definition and then determine which downstream material must be rebuilt or flagged.
-
-#### 2. Chapter edits
-
-Examples:
-- rewrite chapter 3
-- revise chapter 5
-
-These rebuild chapter-derived truth outputs.
-
-#### 3. Local text edits
-
-Examples:
-- rewrite one paragraph
-- change the ending sentence
-
-These still require reanalysis of the affected chapter.
-
-#### 4. Direction/rule edits
-
-Examples:
-- update `current_focus`
-- update `author_intent`
-- edit `book_rules`
-- edit `volume_outline`
-
-These do not always require rewriting old chapters, but they must affect future planning deterministically.
-
-### Consistency Rules
-
-The edit controller should enforce:
-- chapter body is authoritative for “what happened in this chapter”
-- explicit user override is authoritative for user-owned fields
-- truth projections must be regenerated from edited content where applicable
-- downstream chapters may be marked stale if an upstream edit invalidates assumptions
-
-## Status, Events, and Interaction Feedback
-
-This system needs explicit event flow, not ad-hoc log strings.
-
-### Event Stream
-
-New shared execution events should include:
-- `session.bound`
-- `book.selected`
-- `task.started`
-- `task.progress`
-- `task.waiting_human`
-- `task.completed`
-- `task.failed`
-- `edit.applied`
-- `truth.updated`
-- `mode.changed`
-
-### Stage Visibility
-
-The user should always see:
-- active book
-- active chapter
-- stage
-- last successful action
-- current warning/block reason
-
-### Interaction Animation
-
-Animations should communicate process, not decoration.
-
-Required feedback:
-- active stage indicator
-- progress/event stream
-- visible `waiting_human` state
-- clear acceptance / rollback / rewrite transitions
-
-No decorative motion that does not improve process readability.
-
-## TUI Shape
-
-The `TUI` is the first shell, but it must be designed as a reusable client for the shared control layer.
-
-### Main layout
-
-- **Top status bar**
-  - project
-  - active book
-  - automation mode
-  - current stage
-- **Center conversation pane**
-  - user messages
-  - assistant responses
-  - system event summaries
-- **Right or bottom process pane**
-  - current task
-  - last 10 events
-  - pending decisions
-  - current warnings
-- **Input row**
-  - natural-language input
-  - optional slash commands
-
-### Slash commands
-
-Support a small, stable command layer:
-- `/books`
-- `/open <book>`
-- `/new`
-- `/write`
-- `/pause`
-- `/resume`
-- `/mode`
-- `/revise`
-- `/rewrite`
-- `/focus`
-- `/intent`
-- `/truth`
-- `/export`
-- `/status`
-
-Natural language remains primary.
-
-## Studio Shape
-
-Studio should stop treating chat as a side widget over a page collection.
-
-Instead:
-- chat becomes a first-class surface over the same interaction core
-- book pages become supporting views, not the only control mechanism
-- daemon/log/truth views subscribe to the same execution event model
-
-Studio should preserve its richer visual editing affordances, but it should not own separate orchestration logic.
-
-## File and Module Boundaries
-
-This task is large, so file size control must be a design constraint from day one.
-
-### New core modules
-
-Create a focused module family, for example:
-
-- `packages/core/src/interaction/session.ts`
-- `packages/core/src/interaction/intents.ts`
-- `packages/core/src/interaction/router.ts`
-- `packages/core/src/interaction/runtime.ts`
-- `packages/core/src/interaction/events.ts`
-- `packages/core/src/interaction/modes.ts`
-- `packages/core/src/interaction/edit-controller.ts`
-- `packages/core/src/interaction/truth-authority.ts`
-
-### New CLI/TUI modules
-
-- `packages/cli/src/tui/app.tsx`
-- `packages/cli/src/tui/layout.tsx`
-- `packages/cli/src/tui/session-view.tsx`
-- `packages/cli/src/tui/status-pane.tsx`
-- `packages/cli/src/tui/input-bar.tsx`
-- `packages/cli/src/tui/commands.ts`
-
-### Studio changes
-
-Keep Studio changes shallow:
-- replace `/api/agent` one-shot orchestration with shared control-layer API
-- adapt existing pages to subscribe to shared events
-- move current `ChatBar` toward a shared interaction client
-
-### File size guardrails
-
-Hard constraints:
-- New files should target `< 250` lines.
-- Orchestrator files may reach `<= 350` lines if unavoidable.
-- No new monolith comparable to `runner.ts`.
-- Shared types go in dedicated model files, not in shells.
-- UI shells should remain thin and call shared control-layer modules.
-
-## Rollout Plan
-
-### Phase 1: Shared models and runtime bridge
-
-Build:
-- session model
-- intent model
-- execution status/events
-- automation modes
-- runtime bridge to existing pipeline actions
-
-No UI replacement yet.
-
-### Phase 2: TUI shell
-
-Build the project-scoped TUI:
-- project startup
-- active book binding
-- chat input
-- process/status pane
-- core commands
-
-### Phase 3: Human edit transactions
-
-Add:
-- chapter-level edit controller
-- truth-file-aware edit flow
-- entity rename flow
-
-### Phase 4: Studio adoption
-
-Refit Studio:
-- shared conversation brain
-- shared event/status model
-- replace one-shot chat behavior
-
-## What This Design Explicitly Avoids
-
-- no separate Studio and TUI orchestration stacks
-- no top-heavy onboarding questionnaire
-- no raw file editing as the primary mutation model
-- no giant new “god file”
-- no rewriting the entire pipeline before the control layer exists
-
-## Recommendation
-
-Implement this as a new long-running branch rooted in an isolated worktree.
-
-The order should be:
-1. shared interaction/control models
-2. runtime bridge
-3. TUI shell
-4. edit controller
-5. Studio migration
-
-That keeps the architecture correct while still delivering the writing-workbench experience early through TUI.

+ 0 - 523
docs/plans/2026-04-06-interaction-control-layer-implementation.md

@@ -1,523 +0,0 @@
-# Interaction Control Layer Implementation Plan
-
-> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
-
-**Goal:** Build a shared interaction control layer that powers a project-scoped writing TUI first and becomes the common control brain for both TUI and Studio.
-
-**Architecture:** Introduce a new `core/interaction` subsystem for session state, intent routing, execution status, automation policy, and edit transactions. Keep `PipelineRunner` as the execution substrate, build a thin TUI shell in `packages/cli`, and refit Studio to call the same interaction APIs instead of owning separate orchestration logic.
-
-**Tech Stack:** TypeScript, InkOS core pipeline, Commander CLI, Ink-based TUI shell, existing Studio React client, Vitest.
-
----
-
-### Task 1: Add interaction domain models in core
-
-**Files:**
-- Create: `packages/core/src/interaction/session.ts`
-- Create: `packages/core/src/interaction/intents.ts`
-- Create: `packages/core/src/interaction/modes.ts`
-- Create: `packages/core/src/interaction/events.ts`
-- Modify: `packages/core/src/index.ts`
-- Test: `packages/core/src/__tests__/interaction-models.test.ts`
-
-**Step 1: Write the failing test**
-
-Create coverage for:
-- `InteractionSession`
-- `AutomationMode`
-- `InteractionIntent`
-- `ExecutionStatus`
-- `PendingDecision`
-
-Include assertions for:
-- valid mode parsing
-- valid intent discrimination
-- session book binding
-- event payload shape
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-models.test.ts
-```
-
-Expected:
-- fail because the new modules do not exist
-
-**Step 3: Write minimal implementation**
-
-Implement:
-- `AutomationMode = "auto" | "semi" | "manual"`
-- `InteractionIntentType` union
-- `ExecutionStatus` union
-- `InteractionSession` interface
-- `PendingDecision` interface
-- small helpers:
-  - `bindActiveBook`
-  - `clearPendingDecision`
-  - `isTerminalExecutionStatus`
-
-Keep each file under 200 lines.
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-models.test.ts
-```
-
-Expected:
-- PASS
-
-**Step 5: Commit**
-
-```bash
-git add packages/core/src/interaction/session.ts packages/core/src/interaction/intents.ts packages/core/src/interaction/modes.ts packages/core/src/interaction/events.ts packages/core/src/index.ts packages/core/src/__tests__/interaction-models.test.ts
-git commit -m "feat(interaction): add shared control models"
-```
-
-### Task 2: Build the interaction runtime bridge
-
-**Files:**
-- Create: `packages/core/src/interaction/runtime.ts`
-- Create: `packages/core/src/interaction/request-router.ts`
-- Modify: `packages/core/src/index.ts`
-- Test: `packages/core/src/__tests__/interaction-runtime.test.ts`
-
-**Step 1: Write the failing test**
-
-Cover:
-- `continue_book` routes to `writeNextChapter`
-- `revise_chapter` routes to `reviseDraft`
-- `rewrite_chapter` routes to `reviseDraft(mode="rewrite")`
-- `update_current_focus` routes to the existing write surface
-- `switch_mode` updates session policy only
-
-Use a mocked `PipelineRunner`-shaped object.
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-runtime.test.ts
-```
-
-Expected:
-- fail because runtime bridge is missing
-
-**Step 3: Write minimal implementation**
-
-Implement:
-- `InteractionRuntime`
-- `runInteractionRequest(...)`
-- `routeIntentToRequest(...)`
-
-Rules:
-- no direct filesystem edits in this layer
-- only call existing pipeline capabilities
-- emit explicit `ExecutionStatus` transitions
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-runtime.test.ts
-```
-
-Expected:
-- PASS
-
-**Step 5: Commit**
-
-```bash
-git add packages/core/src/interaction/runtime.ts packages/core/src/interaction/request-router.ts packages/core/src/index.ts packages/core/src/__tests__/interaction-runtime.test.ts
-git commit -m "feat(interaction): add runtime bridge"
-```
-
-### Task 3: Introduce a project-scoped TUI entry
-
-**Files:**
-- Create: `packages/cli/src/commands/tui.ts`
-- Modify: `packages/cli/src/index.ts`
-- Test: `packages/cli/src/__tests__/tui-command.test.ts`
-
-**Step 1: Write the failing test**
-
-Cover:
-- `inkos` without a subcommand launches the TUI entry
-- current working directory is treated as project root
-- when no project config exists, the TUI still opens in a neutral state
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/cli exec vitest run src/__tests__/tui-command.test.ts
-```
-
-Expected:
-- fail because command does not exist
-
-**Step 3: Write minimal implementation**
-
-Implement:
-- `tuiCommand`
-- fallback behavior so `inkos` opens TUI when no subcommand is provided
-
-Do not add visual complexity yet.
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/cli exec vitest run src/__tests__/tui-command.test.ts
-```
-
-Expected:
-- PASS
-
-**Step 5: Commit**
-
-```bash
-git add packages/cli/src/commands/tui.ts packages/cli/src/index.ts packages/cli/src/__tests__/tui-command.test.ts
-git commit -m "feat(cli): add project-scoped TUI entry"
-```
-
-### Task 4: Scaffold the TUI shell layout
-
-**Files:**
-- Create: `packages/cli/src/tui/app.tsx`
-- Create: `packages/cli/src/tui/status-bar.tsx`
-- Create: `packages/cli/src/tui/session-pane.tsx`
-- Create: `packages/cli/src/tui/process-pane.tsx`
-- Create: `packages/cli/src/tui/input-bar.tsx`
-- Test: `packages/cli/src/__tests__/tui-layout.test.tsx`
-
-**Step 1: Write the failing test**
-
-Cover rendering for:
-- status bar
-- empty session pane
-- process pane with current stage
-- input bar placeholder
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/cli exec vitest run src/__tests__/tui-layout.test.tsx
-```
-
-Expected:
-- fail because TUI components are missing
-
-**Step 3: Write minimal implementation**
-
-Render:
-- project name
-- active book
-- automation mode
-- current stage
-- empty conversation area
-- process/status area
-
-Keep all components small:
-- target `< 180` lines each
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/cli exec vitest run src/__tests__/tui-layout.test.tsx
-```
-
-Expected:
-- PASS
-
-**Step 5: Commit**
-
-```bash
-git add packages/cli/src/tui/app.tsx packages/cli/src/tui/status-bar.tsx packages/cli/src/tui/session-pane.tsx packages/cli/src/tui/process-pane.tsx packages/cli/src/tui/input-bar.tsx packages/cli/src/__tests__/tui-layout.test.tsx
-git commit -m "feat(tui): scaffold interaction shell"
-```
-
-### Task 5: Add natural-language intent parsing for first-wave commands
-
-**Files:**
-- Create: `packages/core/src/interaction/nl-router.ts`
-- Modify: `packages/core/src/interaction/request-router.ts`
-- Test: `packages/core/src/__tests__/interaction-nl-router.test.ts`
-
-**Step 1: Write the failing test**
-
-Cover parsing for:
-- “continue”
-- “write next”
-- “pause this book”
-- “rewrite chapter 3”
-- “revise chapter 5 ending only”
-- “set focus back to the old case”
-- “why did the protagonist name not change”
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-nl-router.test.ts
-```
-
-Expected:
-- fail because parser is missing
-
-**Step 3: Write minimal implementation**
-
-Implement a deterministic first-wave parser:
-- command-first and phrase-first
-- no LLM dependency in phase 1
-- extract:
-  - intent
-  - chapter number
-  - instruction payload
-  - optional scope hints
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-nl-router.test.ts
-```
-
-Expected:
-- PASS
-
-**Step 5: Commit**
-
-```bash
-git add packages/core/src/interaction/nl-router.ts packages/core/src/interaction/request-router.ts packages/core/src/__tests__/interaction-nl-router.test.ts
-git commit -m "feat(interaction): add deterministic natural-language routing"
-```
-
-### Task 6: Implement automation modes and stop behavior
-
-**Files:**
-- Modify: `packages/core/src/interaction/modes.ts`
-- Modify: `packages/core/src/interaction/runtime.ts`
-- Modify: `packages/core/src/pipeline/runner.ts`
-- Test: `packages/core/src/__tests__/interaction-modes.test.ts`
-
-**Step 1: Write the failing test**
-
-Cover:
-- `auto` continues chapter progression unless a hard stop occurs
-- `semi` requires an explicit next-chapter start
-- `manual` never self-continues
-- `state-degraded` still hard-blocks in all modes
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-modes.test.ts
-```
-
-Expected:
-- fail because runtime does not honor these policies
-
-**Step 3: Write minimal implementation**
-
-Add:
-- mode-aware continuation checks
-- mode exposure in session/runtime status
-- no duplicate policy logic in CLI and Studio
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-modes.test.ts
-```
-
-Expected:
-- PASS
-
-**Step 5: Commit**
-
-```bash
-git add packages/core/src/interaction/modes.ts packages/core/src/interaction/runtime.ts packages/core/src/pipeline/runner.ts packages/core/src/__tests__/interaction-modes.test.ts
-git commit -m "feat(interaction): add automation modes"
-```
-
-### Task 7: Add edit controller for chapter and truth-file transactions
-
-**Files:**
-- Create: `packages/core/src/interaction/edit-controller.ts`
-- Create: `packages/core/src/interaction/truth-authority.ts`
-- Test: `packages/core/src/__tests__/edit-controller.test.ts`
-
-**Step 1: Write the failing test**
-
-Cover:
-- chapter rewrite produces a rebuild-required action
-- local paragraph edit marks only the affected chapter dirty
-- truth-file edit is classified as:
-  - direction edit
-  - truth authority edit
-  - entity edit
-- entity rename returns affected-scope metadata
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/edit-controller.test.ts
-```
-
-Expected:
-- fail because edit controller is missing
-
-**Step 3: Write minimal implementation**
-
-Implement:
-- edit transaction types
-- affected-scope classification
-- truth authority resolution helpers
-
-Do not yet perform all downstream rewrites automatically; phase 1 only needs correct planning and scope marking.
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/edit-controller.test.ts
-```
-
-Expected:
-- PASS
-
-**Step 5: Commit**
-
-```bash
-git add packages/core/src/interaction/edit-controller.ts packages/core/src/interaction/truth-authority.ts packages/core/src/__tests__/edit-controller.test.ts
-git commit -m "feat(interaction): add edit controller"
-```
-
-### Task 8: Connect Studio to the shared control layer
-
-**Files:**
-- Modify: `packages/studio/src/api/server.ts`
-- Modify: `packages/studio/src/components/ChatBar.tsx`
-- Modify: `packages/studio/src/App.tsx`
-- Test: `packages/studio/src/api/server.test.ts`
-- Test: `packages/studio/src/components/chatbar-state.test.ts`
-
-**Step 1: Write the failing test**
-
-Cover:
-- Studio chat routes through shared interaction runtime
-- active book binding is preserved
-- stage/status events are surfaced through the same event model
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/studio exec vitest run src/api/server.test.ts src/components/chatbar-state.test.ts
-```
-
-Expected:
-- fail because Studio still uses one-shot `/api/agent`
-
-**Step 3: Write minimal implementation**
-
-Replace one-shot behavior with:
-- session-aware interaction endpoint(s)
-- shared status/event contract
-- ChatBar updates from the shared control state
-
-Keep Studio page structure mostly intact for phase 1.
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/studio exec vitest run src/api/server.test.ts src/components/chatbar-state.test.ts
-```
-
-Expected:
-- PASS
-
-**Step 5: Commit**
-
-```bash
-git add packages/studio/src/api/server.ts packages/studio/src/components/ChatBar.tsx packages/studio/src/App.tsx packages/studio/src/api/server.test.ts packages/studio/src/components/chatbar-state.test.ts
-git commit -m "feat(studio): route chat through interaction control layer"
-```
-
-### Task 9: Run end-to-end verification for TUI + core
-
-**Files:**
-- Modify: `packages/cli/src/__tests__/cli-integration.test.ts`
-- Modify: `packages/core/src/__tests__/pipeline-agent.test.ts`
-
-**Step 1: Write the failing test**
-
-Add one flow that covers:
-- launch TUI in project context
-- bind active book
-- send natural-language “write next”
-- observe stage/status progression
-- switch to `semi`
-
-**Step 2: Run test to verify it fails**
-
-Run:
-
-```bash
-pnpm --dir packages/cli exec vitest run src/__tests__/cli-integration.test.ts
-```
-
-Expected:
-- fail because the new flow is not wired
-
-**Step 3: Write minimal implementation**
-
-Fill any missing glue only.
-
-Avoid broad refactors at this stage.
-
-**Step 4: Run test to verify it passes**
-
-Run:
-
-```bash
-pnpm --dir packages/cli exec vitest run src/__tests__/cli-integration.test.ts
-pnpm --dir packages/core exec tsc --noEmit --pretty false
-pnpm --dir packages/core run build
-```
-
-Expected:
-- all pass
-
-**Step 5: Commit**
-
-```bash
-git add packages/cli/src/__tests__/cli-integration.test.ts packages/core/src/__tests__/pipeline-agent.test.ts
-git commit -m "test(interaction): verify end-to-end control flow"
-```

+ 0 - 89
docs/plans/2026-04-09-tui-floating-input-implementation.md

@@ -1,89 +0,0 @@
-# TUI Floating Input Implementation Plan
-
-> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
-
-**Goal:** Make the TUI input area feel closer to Codex by giving it a floating input-shell look with clearer bottom spacing.
-
-**Architecture:** Keep the existing REPL loop and natural-language flow intact. Only reshape the prompt chrome: extract a small render helper in the TUI effects layer, use it from the app loop, and lock the visual contract with a focused CLI test.
-
-**Tech Stack:** TypeScript, Node readline, Vitest
-
----
-
-### Task 1: Add a failing test for floating input chrome
-
-**Files:**
-- Create: `packages/cli/src/__tests__/tui-input-chrome.test.ts`
-- Reference: `packages/cli/src/tui/effects.ts`
-
-**Step 1: Write the failing test**
-
-Add tests that expect:
-- a bounded/floating top border line
-- a prompt prefix that includes inner padding
-- bottom spacing metadata greater than zero
-
-**Step 2: Run test to verify it fails**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-input-chrome.test.ts`
-
-Expected: FAIL because the helper does not exist yet.
-
-**Step 3: Write minimal implementation**
-
-Add a small helper in `effects.ts` that builds the input chrome description from terminal width.
-
-**Step 4: Run test to verify it passes**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-input-chrome.test.ts`
-
-Expected: PASS
-
-### Task 2: Wire the floating chrome into the TUI prompt loop
-
-**Files:**
-- Modify: `packages/cli/src/tui/app.ts`
-- Modify: `packages/cli/src/tui/effects.ts`
-
-**Step 1: Write the failing test**
-
-Extend the input-chrome test (or add a small app-facing assertion) so the exported prompt prefix and spacing are stable enough to drive the REPL loop.
-
-**Step 2: Run test to verify it fails**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-input-chrome.test.ts src/__tests__/tui-layout.test.ts`
-
-Expected: FAIL until the app loop uses the new chrome contract.
-
-**Step 3: Write minimal implementation**
-
-Update `app.ts` so:
-- the prompt string comes from the chrome helper
-- the input area prints a floating top border and helper line
-- the prompt is not visually glued to the terminal bottom
-
-**Step 4: Run test to verify it passes**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-input-chrome.test.ts src/__tests__/tui-layout.test.ts`
-
-Expected: PASS
-
-### Task 3: Verify CLI package build
-
-**Files:**
-- Modify: `packages/cli/src/tui/app.ts`
-- Modify: `packages/cli/src/tui/effects.ts`
-- Test: `packages/cli/src/__tests__/tui-input-chrome.test.ts`
-
-**Step 1: Run package build**
-
-Run: `pnpm --dir packages/cli run build`
-
-Expected: PASS
-
-**Step 2: Commit**
-
-```bash
-git add docs/plans/2026-04-09-tui-floating-input-implementation.md packages/cli/src/tui/app.ts packages/cli/src/tui/effects.ts packages/cli/src/__tests__/tui-input-chrome.test.ts
-git commit -m "feat(tui): float input chrome above terminal edge"
-```

+ 0 - 179
docs/plans/2026-04-10-interaction-create-export-runtime.md

@@ -1,179 +0,0 @@
-# Interaction Create/Export Runtime Implementation Plan
-
-> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
-
-**Goal:** Finish the remaining shared interaction-layer work by wiring `create_book` and `export_book` into the shared runtime and moving Studio's create/export flows onto the same execution path.
-
-**Architecture:** Keep the existing natural-language interaction path for chat/TUI/OpenClaw, but add a structured interaction entrypoint for UI-driven actions. Shared runtime tools will own create/export behavior so CLI, Studio, and external agents can reuse the same capability surface.
-
-**Tech Stack:** TypeScript, Vitest, Hono, Commander, InkOS core pipeline/session tooling.
-
----
-
-### Task 1: Add failing core tests for create/export runtime behavior
-
-**Files:**
-- Modify: `packages/core/src/__tests__/interaction-runtime.test.ts`
-- Modify: `packages/core/src/__tests__/project-interaction.test.ts`
-
-**Step 1: Write failing tests**
-
-- Add a runtime test proving `create_book` calls a new `createBook` tool, binds the created book, and returns its summary text.
-- Add a runtime test proving `export_book` calls a new `exportBook` tool with format/approved-only options and returns export metadata text.
-- Add a project-control test proving structured interaction requests persist session updates for `create_book`.
-
-**Step 2: Run tests to verify they fail**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run \
-  src/__tests__/interaction-runtime.test.ts \
-  src/__tests__/project-interaction.test.ts
-```
-
-Expected: failing tests due to missing runtime tool methods / structured request helper.
-
-### Task 2: Implement shared create/export runtime support
-
-**Files:**
-- Modify: `packages/core/src/interaction/intents.ts`
-- Modify: `packages/core/src/interaction/runtime.ts`
-- Modify: `packages/core/src/interaction/project-control.ts`
-- Modify: `packages/core/src/interaction/project-tools.ts`
-
-**Step 1: Extend interaction request/runtime contracts**
-
-- Add structured fields for create/export:
-  - `title`
-  - `genre`
-  - `platform`
-  - `chapterWordCount`
-  - `targetChapters`
-  - `format`
-  - `approvedOnly`
-  - `outputPath`
-- Add runtime tool methods:
-  - `createBook`
-  - `exportBook`
-
-**Step 2: Implement structured project interaction helper**
-
-- Add `processProjectInteractionRequest(...)` alongside the existing natural-language helper.
-- It should:
-  - load session
-  - optionally bind `activeBookId`
-  - execute `runInteractionRequest`
-  - persist the updated session
-
-**Step 3: Implement create/export tool behavior**
-
-- `createBook`:
-  - derive a book config
-  - call `PipelineRunner.initBook`
-  - return interaction metadata with `responseText`
-- `exportBook`:
-  - centralize the existing CLI export logic into the shared tool
-  - return output path / exported chapter count in interaction metadata
-
-**Step 4: Run tests**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run \
-  src/__tests__/interaction-runtime.test.ts \
-  src/__tests__/project-interaction.test.ts
-```
-
-Expected: PASS.
-
-### Task 3: Add CLI routing/tests for shared create/export
-
-**Files:**
-- Modify: `packages/core/src/interaction/nl-router.ts`
-- Modify: `packages/core/src/__tests__/interaction-nl-router.test.ts`
-- Modify: `packages/cli/src/__tests__/interact-command.test.ts`
-
-**Step 1: Write failing tests**
-
-- Add NL routing coverage for:
-  - `/new <title>`
-  - `/export`
-  - `/export md`
-- Add interact command coverage for structured/shared export output where useful.
-
-**Step 2: Implement minimal routing**
-
-- Route slash commands into `create_book` / `export_book`.
-- Keep this scoped to explicit commands, not full ideation.
-
-**Step 3: Run tests**
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run src/__tests__/interaction-nl-router.test.ts
-pnpm --dir packages/cli exec vitest run src/__tests__/interact-command.test.ts
-```
-
-Expected: PASS.
-
-### Task 4: Move Studio create/export endpoints onto shared interaction execution
-
-**Files:**
-- Modify: `packages/studio/src/api/server.ts`
-- Modify: `packages/studio/src/api/server.test.ts`
-
-**Step 1: Write failing tests**
-
-- Add server tests proving:
-  - `/api/books/create` routes through shared structured interaction execution
-  - `/api/books/:id/export-save` routes through shared structured interaction execution
-
-**Step 2: Implement endpoint changes**
-
-- Use the same shared interaction tools built from pipeline + state.
-- Replace direct `initBook` / custom export-save logic with calls to the shared structured helper.
-- Preserve existing response shape expected by the Studio UI.
-
-**Step 3: Run tests**
-
-Run:
-
-```bash
-pnpm --dir packages/studio exec vitest run src/api/server.test.ts
-```
-
-Expected: PASS.
-
-### Task 5: Final verification
-
-**Files:**
-- No new files
-
-**Step 1: Run focused test/build suite**
-
-```bash
-pnpm --dir packages/core exec vitest run \
-  src/__tests__/interaction-runtime.test.ts \
-  src/__tests__/project-interaction.test.ts \
-  src/__tests__/interaction-nl-router.test.ts
-pnpm --dir packages/cli exec vitest run src/__tests__/interact-command.test.ts
-pnpm --dir packages/studio exec vitest run src/api/server.test.ts
-pnpm --dir packages/core run build
-pnpm --dir packages/cli run build
-pnpm --dir packages/studio run build
-```
-
-Expected: all green.
-
-**Step 2: Commit**
-
-```bash
-git add packages/core/src/interaction packages/core/src/__tests__ \
-  packages/cli/src/__tests__/interact-command.test.ts \
-  packages/studio/src/api/server.ts packages/studio/src/api/server.test.ts \
-  docs/plans/2026-04-10-interaction-create-export-runtime.md
-git commit -m "feat(interaction): add shared create and export flows"
-```

+ 0 - 76
docs/plans/2026-04-11-ink-tui-dashboard-design.md

@@ -1,76 +0,0 @@
-# Ink TUI Dashboard Design
-
-**Goal:** Replace the current readline-driven TUI shell with a fixed-layout Ink dashboard so conversation, execution status, and the composer remain visible at the same time.
-
-## Context
-
-The current TUI is a linear REPL layered on top of `readline` and ANSI helpers. That shape creates the exact UX problems reported by users:
-
-- the input area is only a prompt prefix, not a persistent composer
-- task status is printed inline below the conversation instead of being anchored near the composer
-- output pushes the input area downward, so the screen feels unstable
-- the shell looks like logs, not a workspace
-
-The interaction core itself is not the problem. Session state, routing, execution, and persistence already exist in `@actalk/inkos-core`.
-
-## Proposed Architecture
-
-Keep the existing interaction core and replace only the CLI shell:
-
-- `packages/cli/src/tui/app.ts`
-  becomes a thin launcher that prepares project/model/tools and mounts an Ink app
-- new Ink UI modules in `packages/cli/src/tui/`
-  own layout, input, and rendering
-- existing session persistence stays in `session-store.ts`
-- existing command execution still flows through `processProjectInteractionInput`
-
-## Layout
-
-The dashboard is a fixed vertical stack:
-
-1. `Header`
-   project, active book, automation mode, model, and a compact execution badge
-2. `Conversation`
-   recent user / assistant / system messages with stable visual separation
-3. `Status Rail`
-   current stage, pending decision, and recent events
-4. `Composer`
-   highlighted input box, helper text, and submit state
-
-The composer stays visually anchored at the bottom of the dashboard. Execution state sits directly above it.
-
-## Rendering Strategy
-
-Use Ink components instead of manual `console.log` output:
-
-- Ink layout primitives for fixed regions
-- Ink input handling for keyboard events
-- an Ink text input component for the composer
-- small view-model helpers that derive display data from the persisted interaction session
-
-No screen-level ANSI animation survives unless it can be expressed as component state. The redesign favors a stable, readable shell over decorative startup animation.
-
-## Interaction Model
-
-- user submits text in the composer
-- shell enters `submitting` state
-- `processProjectInteractionInput` runs with existing tools
-- returned session replaces local session state
-- conversation and status panes refresh from the updated session
-
-Errors are shown in the status rail and remain visible until the next successful interaction.
-
-## Non-Goals
-
-- changing the interaction runtime or natural-language router
-- changing daemon behavior
-- adding a full message history scroller in this pass
-- introducing Studio-style navigation into CLI
-
-## Success Criteria
-
-- the composer is always visually distinct and highlighted
-- the current execution state is visible without running `/status`
-- recent events appear above the composer instead of below it
-- new output no longer pushes the prompt into a visually unstable position
-- the CLI package still builds and TUI-focused tests cover the new layout contract

+ 0 - 153
docs/plans/2026-04-11-ink-tui-dashboard-implementation.md

@@ -1,153 +0,0 @@
-# Ink TUI Dashboard Implementation Plan
-
-> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
-
-**Goal:** Rebuild the InkOS CLI TUI as a fixed-layout Ink dashboard with a persistent highlighted composer and a status rail directly above it.
-
-**Architecture:** Keep `@actalk/inkos-core` unchanged and swap the CLI shell from `readline + ANSI` to `Ink + React`. `app.ts` becomes the launcher; new dashboard components render header, conversation, status, and composer from persisted interaction session data.
-
-**Tech Stack:** TypeScript, React, Ink, Vitest
-
----
-
-### Task 1: Add the Ink runtime dependencies
-
-**Files:**
-- Modify: `packages/cli/package.json`
-- Modify: `pnpm-lock.yaml`
-
-**Step 1: Add CLI dependencies**
-
-Add the runtime and test dependencies needed for the new shell.
-
-**Step 2: Verify installation**
-
-Run: `pnpm --dir packages/cli install`
-
-Expected: dependencies resolve and lockfile updates cleanly.
-
-### Task 2: Add failing tests for the dashboard contract
-
-**Files:**
-- Modify: `packages/cli/src/__tests__/tui-layout.test.ts`
-- Create: `packages/cli/src/__tests__/tui-dashboard.test.tsx`
-
-**Step 1: Write failing tests**
-
-Cover:
-- header displays project, book, mode, and model
-- status rail appears above the composer
-- composer placeholder / highlight shell renders
-- conversation pane renders user and assistant messages separately
-
-**Step 2: Run tests to verify they fail**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-layout.test.ts src/__tests__/tui-dashboard.test.tsx`
-
-Expected: FAIL because the Ink dashboard components do not exist yet.
-
-### Task 3: Build dashboard view-model helpers
-
-**Files:**
-- Create: `packages/cli/src/tui/dashboard-model.ts`
-- Create: `packages/cli/src/tui/dashboard-model.test.ts`
-
-**Step 1: Write failing tests**
-
-Verify session data is mapped into:
-- header badge data
-- conversation rows
-- recent event rows
-- pending decision summary
-
-**Step 2: Run tests to verify they fail**
-
-Run: `pnpm --dir packages/cli exec vitest run src/tui/dashboard-model.test.ts`
-
-Expected: FAIL because the helpers do not exist yet.
-
-**Step 3: Write minimal implementation**
-
-Create pure helpers so the Ink components can stay thin.
-
-**Step 4: Run tests to verify they pass**
-
-Run: `pnpm --dir packages/cli exec vitest run src/tui/dashboard-model.test.ts`
-
-Expected: PASS
-
-### Task 4: Implement the Ink dashboard shell
-
-**Files:**
-- Create: `packages/cli/src/tui/dashboard.tsx`
-- Modify: `packages/cli/src/tui/app.ts`
-- Optionally modify: `packages/cli/src/tui/output.ts`
-
-**Step 1: Write or extend a failing dashboard render test**
-
-Assert that the mounted dashboard contains:
-- a fixed header
-- conversation content
-- status rail
-- highlighted composer
-
-**Step 2: Run tests to verify they fail**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-dashboard.test.tsx`
-
-Expected: FAIL
-
-**Step 3: Write minimal implementation**
-
-Implement:
-- `InkTuiDashboard` component
-- local submit state
-- composer submission through `processProjectInteractionInput`
-- session-driven refresh after each interaction
-
-**Step 4: Run tests to verify they pass**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-dashboard.test.tsx src/__tests__/tui-layout.test.ts`
-
-Expected: PASS
-
-### Task 5: Reconcile launcher behavior and remove obsolete readline assumptions
-
-**Files:**
-- Modify: `packages/cli/src/tui/app.ts`
-- Modify: `packages/cli/src/tui/effects.ts`
-- Modify or remove: old prompt-related tests as needed
-
-**Step 1: Replace the old REPL entry**
-
-Make `launchTui()` mount Ink instead of starting a `readline` loop.
-
-**Step 2: Verify startup / setup flow**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-command.test.ts src/__tests__/tui-layout.test.ts src/__tests__/tui-dashboard.test.tsx`
-
-Expected: PASS
-
-### Task 6: Build verification
-
-**Files:**
-- Modify: any files touched above
-
-**Step 1: Run focused tests**
-
-Run: `pnpm --dir packages/cli exec vitest run src/__tests__/tui-layout.test.ts src/__tests__/tui-dashboard.test.tsx`
-
-Expected: PASS
-
-**Step 2: Run CLI build**
-
-Run: `pnpm --dir packages/cli run build`
-
-Expected: PASS
-
-**Step 3: Commit**
-
-```bash
-git add docs/plans/2026-04-11-ink-tui-dashboard-design.md docs/plans/2026-04-11-ink-tui-dashboard-implementation.md packages/cli/package.json pnpm-lock.yaml packages/cli/src/tui/app.ts packages/cli/src/tui/dashboard.tsx packages/cli/src/tui/dashboard-model.ts packages/cli/src/__tests__/tui-layout.test.ts packages/cli/src/__tests__/tui-dashboard.test.tsx
-git commit -m "feat(tui): rebuild CLI shell with Ink dashboard"
-```

+ 0 - 118
docs/plans/2026-04-13-book-draft-conversation-design.md

@@ -1,118 +0,0 @@
-# Book Draft Conversation Design
-
-## Goal
-
-Fill the missing front-half interaction layer inside `interaction-control-layer` by adding a shared book-draft conversation that works in both `TUI` and `Studio Chat`.
-
-This is not the full “creative operating system” yet. It is the first complete loop for:
-- vague idea input
-- iterative draft refinement
-- shared draft state across shells
-- explicit conversion from draft to book creation
-
-## Scope
-
-### Included
-- shared `creationDraft` state inside the project interaction session
-- natural-language ideation when no active book is bound
-- `/create` to create a book from the current draft
-- `/discard` to drop the current draft
-- Studio Chat / TUI synchronization through the same session file
-
-### Excluded
-- full title/blurb/outline negotiation UI
-- foundation diff / outline revision workflow
-- automatic truth/sqlite rebuild after manual chapter edits
-
-## Product Behavior
-
-### No active book
-
-When the project has no active book and the user enters freeform text, the interaction layer treats it as book ideation instead of generic chat.
-
-Example:
-
-```text
-我想写个港风商战悬疑,主角从灰产洗白。
-```
-
-The system responds with:
-- a tightened shared draft
-- one focused next question
-
-### Shared draft
-
-The draft lives in project session state and can be resumed from:
-- TUI
-- Studio Chat
-- external agent entrypoints
-
-### Explicit creation
-
-Users finalize the draft through:
-
-```text
-/create
-```
-
-This converts the shared draft into the existing structured `create_book` path.
-
-### Explicit discard
-
-Users can drop the draft through:
-
-```text
-/discard
-```
-
-## Architecture
-
-### Session
-
-`InteractionSession` gains `creationDraft`.
-
-The draft is the single shared source of truth for:
-- concept
-- optional title / genre / platform / language
-- optional chapter scale fields
-- blurb / author intent / current focus seeds
-- next question
-- missing fields
-- ready-to-create flag
-
-### Routing
-
-`routeNaturalLanguageIntent()` gets one new branch:
-- if no active book is bound, unmatched freeform input routes to `develop_book`
-
-Explicit commands:
-- `/new <idea>` -> `develop_book`
-- `/create` -> `create_book`
-- `/discard` -> `discard_book_draft`
-
-### Runtime
-
-New runtime intents:
-- `develop_book`
-- `discard_book_draft`
-
-`create_book` now fills missing fields from the current draft before calling the existing creation tool.
-
-### Tools
-
-Shared interaction tools gain `developBookDraft`.
-
-It uses the active model to:
-- merge the latest user turn into the current draft
-- return a compact assistant reply
-- return updated structured draft JSON
-
-## Why This Is The Right Cut
-
-This design gives us:
-- a real front-half conversation loop
-- zero duplicate shell logic
-- no new standalone wizard system
-- no collision with the already-working write/revise/export control paths
-
-It is intentionally smaller than the final vision, but it closes the biggest product gap: “I can control a book, but I still can’t converse a new book into existence.”

+ 0 - 58
docs/plans/2026-04-13-book-draft-conversation-implementation.md

@@ -1,58 +0,0 @@
-# Book Draft Conversation Implementation Plan
-
-> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
-
-**Goal:** Add a shared book-draft ideation loop so TUI and Studio Chat can converge a vague story idea into a structured create-ready draft.
-
-**Architecture:** Extend `InteractionSession` with `creationDraft`, route no-active-book freeform input into a new `develop_book` runtime intent, and reuse the existing `create_book` runtime/tool path for finalization.
-
-**Tech Stack:** TypeScript, Vitest, Zod, existing interaction runtime/session/tooling.
-
----
-
-### Task 1: Add shared draft state and intents
-
-**Files:**
-- Modify: `packages/core/src/interaction/session.ts`
-- Modify: `packages/core/src/interaction/intents.ts`
-- Modify: `packages/core/src/index.ts`
-- Test: `packages/core/src/__tests__/interaction-models.test.ts`
-
-### Task 2: Route ideation input
-
-**Files:**
-- Modify: `packages/core/src/interaction/nl-router.ts`
-- Modify: `packages/core/src/interaction/project-control.ts`
-- Test: `packages/core/src/__tests__/interaction-nl-router.test.ts`
-
-### Task 3: Implement runtime + tools
-
-**Files:**
-- Modify: `packages/core/src/interaction/runtime.ts`
-- Modify: `packages/core/src/interaction/project-tools.ts`
-- Test: `packages/core/src/__tests__/interaction-runtime.test.ts`
-- Test: `packages/core/src/__tests__/project-interaction.test.ts`
-
-### Task 4: Surface shared draft in Studio Chat
-
-**Files:**
-- Modify: `packages/studio/src/components/ChatBar.tsx`
-- Test: `packages/studio/src/components/chatbar-state.test.ts`
-
-### Task 5: Verify
-
-Run:
-
-```bash
-pnpm --dir packages/core exec vitest run \
-  src/__tests__/interaction-models.test.ts \
-  src/__tests__/interaction-nl-router.test.ts \
-  src/__tests__/interaction-runtime.test.ts \
-  src/__tests__/project-interaction.test.ts
-pnpm --dir packages/studio exec vitest run \
-  src/components/chatbar-state.test.ts \
-  src/api/server.test.ts
-pnpm --dir packages/core run build
-pnpm --dir packages/cli run build
-pnpm --dir packages/studio run build
-```