APC Headless Runtime and the read-only APC Console are the primary
AgentPatchCheck development paths. Use the Runtime and benchmark documentation
for controlled repair and evaluation workflows; start the Console independently
with cd apc-console, npm ci, and npm run dev.
The root web and desktop commands below are retained upstream/legacy product surface. They remain available for compatibility, but are not the APC Runtime & Evaluation development path.
- Node.js 22+
- npm 10+
npm run install:allFast path:
npm run dev:full- Starts the runtime in watch mode and the Vite web UI dev server together
- Auto-picks free runtime and web UI ports so multiple checkouts can run side by side
- Best for day-to-day source development, especially web UI work and runtime changes that benefit from fast iteration
Manual equivalent in two terminals:
- Runtime server (API + PTY agent runtime):
npm run dev- Runs on
http://127.0.0.1:3484
- Web UI (Vite HMR):
npm run web:dev- Runs on
http://127.0.0.1:4173 /api/*requests from Vite are proxied tohttp://127.0.0.1:3484
Use http://127.0.0.1:4173 while developing UI so changes hot reload.
Use npm run dev:full when you are developing the retained root web and desktop surface and want fast iteration. It runs the source checkout with tsx watch plus the Vite web UI dev server, so runtime changes reload and web UI changes get HMR.
By default, dev:full starts with --skip-shutdown-cleanup so stopping a debug/dev instance does not move cards to Trash or delete task worktrees from active boards.
To opt back into shutdown cleanup while using dev:full, run:
npm run dev:full -- --with-shutdown-cleanupIf node_modules has not been installed in this worktree, dev:full auto-runs npm ci before launch.
Use npm run dogfood when you want to validate the latest built CLI behavior more realistically. It builds the current checkout and launches dist/cli.js, which is better for checking packaged behavior, startup and shutdown flows, multi-instance dogfooding, and launch behavior against a target project.
The repo includes .vscode/launch.json with two configurations:
Dev (Full Stack): Launches the same workflow asnpm run dev:full, starting both the runtime and Vite in one terminal.Run Tests: Runsvitest runwith the debugger so you can set breakpoints in tests.
Shutdown cleanup flags:
--skip-shutdown-cleanup: do not move sessions to trash or delete task worktrees on shutdown
npm run build
node dist/cli.jsThis mode serves built web assets from dist/web-ui and does not hot reload the web UI.
Runtime port options:
# fixed port
node dist/cli.js --port 3484
# pick the first free port starting at 3484
node dist/cli.js --port autoYou can still use KANBAN_RUNTIME_PORT if needed, but --port is preferred for local multi-instance runs.
Run your stable orchestrator first (main checkout):
cd /path/to/AgentPatchCheck-main
npm run build
node dist/cli.js --port 3484Then run a test checkout against a target project (feature worktree):
cd /path/to/AgentPatchCheck-feature-worktree
npm run dogfood -- --project /path/to/target/repo --port autoIf --project is omitted, the launcher starts the retained root CLI from a non-git cwd and opens the first indexed project (if any):
npm run dogfood -- --port autoDogfood launcher behavior:
- builds the current checkout by default
- launches
dist/cli.jswithcwdset to the target project - supports
--port <number|auto> - supports
--no-open - supports
--skip-buildwhen you already built and want faster restarts - is the right choice when you want to test the latest built CLI rather than the source-mode dev server
After cloning and installing dependencies, create/update the global CLI link from this repo:
npm run linkVerify:
which kanban
kanban --versionThis compatibility command can then run from a project directory:
cd /path/to/your/project
kanbanAfter local code changes, run npm run build again before using the linked command.
When switching between worktrees, re-run npm run link from the worktree you want to test so the global kanban binary points at the right dist/cli.js.
Remove the global link:
npm run unlinknpm run build: build runtime and bundled web UI intodistnpm run dogfood -- [--project <path>] [--port <number|auto>] [--no-open] [--skip-build]: build and launch this checkout, optionally targeting a specific project pathnpm run dev: run CLI in watch modenpm run dev:full: run the runtime watch server and Vite web UI dev server togethernpm run web:dev: run web UI dev servernpm run web:build: build web UInpm run typecheck: typecheck runtimenpm run web:typecheck: typecheck web UInpm run test: run runtime testsnpm run web:test: run web UI testsnpm run check: lint, typecheck, and test runtime package
test/integration: integration tests for runtime behavior and startup flowstest/runtime: runtime unit teststest/utilities: shared test helpers
The retained root product surface tracks agent session state with runtime hook events. The core transition model is:
in_progress -> reviewreview -> in_progress
Internal runtime session states are named running and awaiting_review, and hook events are transition intents:
to_in_progressforreview -> in_progressto_reviewforin_progress -> review
How it works end to end:
prepareAgentLaunchwires each agent with hook commands or hook-aware wrappers.- Hook handlers call
kanban hooks ...subcommands. kanban hooks ingest --event <to_review|to_in_progress>reads hook context from env:KANBAN_HOOK_TASK_IDKANBAN_HOOK_WORKSPACE_IDKANBAN_HOOK_PORT
- The ingest command calls runtime TRPC
hooks.ingest. - The runtime applies guarded transitions and ignores duplicates or invalid transitions as no-ops.
Current agent mappings:
These are external agent/file-hook names where the agent config requires them.
They are distinct from Cline SDK plugin runtime hooks such as beforeRun,
beforeTool, afterTool, and afterRun.
- Claude
UserPromptSubmit,PostToolUse,PostToolUseFailureemitto_in_progressStop,PermissionRequest, andNotificationwithpermission_promptemitto_review
- Codex
- wrapper enables TUI session logging and maps:
task_startedandexec_command_begintoto_in_progress*_approval_requesttoto_review
- Codex
notifycompletion path also emitsto_review
- wrapper enables TUI session logging and maps:
- Gemini
BeforeAgentandAfterToolemitto_in_progressAfterAgentemitsto_review- hook command writes
{}to stdout immediately to satisfy Gemini hook contract, then notifies in background
- OpenCode
- plugin maps busy activity to
to_in_progress - plugin maps idle/error and permission ask to
to_review - plugin filters child sessions to avoid false transitions from nested runs
- plugin maps busy activity to
- Droid
PreToolUsefor active tools likeRead,Grep,Glob,FetchUrl,WebSearch,Execute,Task,Edit, andCreateemitsto_in_progressPreToolUseforAskUserandStopemitto_reviewPostToolUseforAskUserandUserPromptSubmitemitto_in_progress
Important behavior details:
- Hooks are best-effort and should not crash or block the underlying agent process.
- Hook notify paths are asynchronous to keep agent UX responsive.
- Runtime transition guards are authoritative and prevent state flapping from duplicate events.
- Hook transport is implemented in Node and invoked through
kanban hooks ..., so the behavior is consistent across Windows and non-Windows environments.
For a full technical breakdown, see:
.plan/docs/runtime-hooks-architecture.md
The web UI reads PostHog settings at build time:
POSTHOG_KEYPOSTHOG_HOST
Local development:
- Set these in
web-ui/.env.local(seeweb-ui/.env.example). - If
POSTHOG_KEYis missing, telemetry does not initialize.
Release builds:
- The publish workflow injects
POSTHOG_KEYandPOSTHOG_HOSTfrom GitHub Secrets. POSTHOG_HOSTis optional and defaults tohttps://data.cline.bot.
Result:
- Official releases have telemetry enabled.
- Forks and source builds have telemetry disabled unless a key is explicitly provided.