For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Repair the reviewed runtime defects with isolated TDD-driven fixes and separate commits.
Architecture: Keep the existing architecture intact and apply narrow behavior corrections at the lock, scheduler, pipeline, and CLI edges. Each task adds a failing test first, implements the smallest fix that passes, and lands in its own commit.
Tech Stack: TypeScript, Node.js, Vitest, Commander, pnpm workspaces
Files:
packages/core/src/__tests__/state-manager.test.tspackages/core/src/pipeline/scheduler.tspackages/core/src/__tests__/scheduler.test.tspackages/core/src/state/manager.tsStep 1: Write the failing tests
Step 2: Run tests to verify they fail
Run: pnpm --filter @actalk/inkos-core test -- --runInBand src/__tests__/state-manager.test.ts src/__tests__/scheduler.test.ts
Expected: failures showing concurrent lock acquisition and/or overlapping cycle execution.
Step 3: Write minimal implementation
Step 4: Run tests to verify they pass
Run the same targeted test command and confirm green.
Step 5: Commit
git add packages/core/src/state/manager.ts packages/core/src/pipeline/scheduler.ts packages/core/src/__tests__/state-manager.test.ts packages/core/src/__tests__/scheduler.test.ts
git commit -m "fix: make book locking atomic and scheduler non-reentrant"
Files:
packages/core/src/__tests__/pipeline-runner.test.tspackages/core/src/pipeline/runner.tsStep 1: Write the failing tests
Step 2: Run tests to verify they fail
Run: pnpm --filter @actalk/inkos-core test -- src/__tests__/pipeline-runner.test.ts
Expected: assertions showing stale baseline use and stale truth-file writes.
Step 3: Write minimal implementation
finalContent into follow-up revision.Step 4: Run tests to verify they pass
Run the same targeted test file and confirm green.
Step 5: Commit
git add packages/core/src/pipeline/runner.ts packages/core/src/__tests__/pipeline-runner.test.ts
git commit -m "fix: keep revision outputs consistent with final chapter text"
Files:
packages/core/src/__tests__/pipeline-runner.test.tspackages/core/src/pipeline/runner.tsStep 1: Write the failing test
Step 2: Run test to verify it fails
Run: pnpm --filter @actalk/inkos-core test -- src/__tests__/pipeline-runner.test.ts
Expected: failure proving the same client instance is reused incorrectly.
Step 3: Write minimal implementation
Step 4: Run test to verify it passes
Run the same targeted test file and confirm green.
Step 5: Commit
git add packages/core/src/pipeline/runner.ts packages/core/src/__tests__/pipeline-runner.test.ts
git commit -m "fix: isolate agent override clients by effective config"
Files:
packages/cli/src/__tests__/cli-integration.test.ts or add focused daemon command testpackages/cli/src/commands/daemon.tsStep 1: Write the failing test
Step 2: Run test to verify it fails
Run: pnpm --filter @actalk/inkos test -- src/__tests__/cli-integration.test.ts
Expected: PID file remains after a failed startup.
Step 3: Write minimal implementation
Step 4: Run test to verify it passes
Run the same targeted CLI test and confirm green.
Step 5: Commit
git add packages/cli/src/commands/daemon.ts packages/cli/src/__tests__/cli-integration.test.ts
git commit -m "fix: clean stale pid files when daemon startup fails"
Files:
packages/cli/src/__tests__/studio.test.tspackages/cli/src/commands/studio.tsStep 1: Write the failing tests
.ts entry launches through npx tsx..js entry launches through node.Step 2: Run tests to verify they fail
Run: pnpm --filter @actalk/inkos test -- src/__tests__/studio.test.ts
Expected: built JavaScript path still routes through tsx.
Step 3: Write minimal implementation
Step 4: Run tests to verify they pass
Run the same targeted test file and confirm green.
Step 5: Commit
git add packages/cli/src/commands/studio.ts packages/cli/src/__tests__/studio.test.ts
git commit -m "fix: launch studio with node for built javascript"
Files:
packages/core/src/__tests__/pipeline-runner.test.tspackages/core/src/pipeline/runner.tsStep 1: Write the failing test
importedCount and totalWords reflect only processed chapters in that run.Step 2: Run test to verify it fails
Run: pnpm --filter @actalk/inkos-core test -- src/__tests__/pipeline-runner.test.ts
Expected: return values count the whole corpus instead of the resumed slice.
Step 3: Write minimal implementation
Step 4: Run test to verify it passes
Run the same targeted test file and confirm green.
Step 5: Commit
git add packages/core/src/pipeline/runner.ts packages/core/src/__tests__/pipeline-runner.test.ts
git commit -m "fix: report resumed imports using processed chapter counts"
Files:
Step 1: Run full verification
Run:
pnpm typecheck
pnpm test
Expected: all targeted fixes pass together. If the packaging test still fails due to local npm cache permissions, note that explicitly and verify all application-level tests separately.
Step 2: Summarize final state