@korallis/k-pi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5619 -0
- package/LICENSE +21 -0
- package/NOTICE +66 -0
- package/README.md +723 -0
- package/dist/bundle/chunks/anthropic-messages-IBCPCIJO.js +45 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-GUUG57CZ.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +74 -0
- package/dist/bundle/chunks/chunk-4L3WN2XY.js +2 -0
- package/dist/bundle/chunks/chunk-6CYCI3EJ.js +12 -0
- package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
- package/dist/bundle/chunks/chunk-AXIIZGTV.js +2 -0
- package/dist/bundle/chunks/chunk-CO7LIZG5.js +2 -0
- package/dist/bundle/chunks/chunk-DRQDKNXA.js +2 -0
- package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
- package/dist/bundle/chunks/chunk-HOFU6X66.js +50 -0
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +2 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-MNAIPA3J.js +2 -0
- package/dist/bundle/chunks/chunk-NBBFIJUL.js +11 -0
- package/dist/bundle/chunks/chunk-NUHFSC37.js +25 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
- package/dist/bundle/chunks/chunk-TRDNDS6A.js +4 -0
- package/dist/bundle/chunks/chunk-UAQELI3K.js +2 -0
- package/dist/bundle/chunks/chunk-X5QHCKY4.js +1653 -0
- package/dist/bundle/chunks/chunk-XDUWOHPL.js +6 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-YRXF7C4I.js +2 -0
- package/dist/bundle/chunks/google-vertex-BVZ6VBRQ.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-HGQMNYVT.js +9 -0
- package/dist/bundle/chunks/mistral-conversations-Q3AWZJAZ.js +5 -0
- package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +3 -0
- package/dist/bundle/chunks/openai-codex-responses-GJVBJXLB.js +8 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-OICQQ5JB.js +7 -0
- package/dist/bundle/chunks/openai-responses-P5LIZTXX.js +2 -0
- package/dist/bundle/chunks/openrouter-images-XTKS2AS3.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pi-messages-TPFH44NP.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/src-UK77SYZE.js +4 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli.js +3 -0
- package/dist/bundle/client.js +2 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/kpi/graphs/coding-loop.auto.json +377 -0
- package/dist/kpi/graphs/coding-loop.gated.json +417 -0
- package/dist/kpi/graphs/spec-first.json +40 -0
- package/dist/kpi/kstack/NOTICE +5 -0
- package/dist/kpi/kstack/UPSTREAM.md +23 -0
- package/dist/kpi/kstack/generated/LICENSE +21 -0
- package/dist/kpi/kstack/generated/skills/architect/SKILL.md +83 -0
- package/dist/kpi/kstack/generated/skills/architect/references/design-red-flags.md +33 -0
- package/dist/kpi/kstack/generated/skills/architect/references/rationale-template.md +35 -0
- package/dist/kpi/kstack/generated/skills/architect/references/runner-prompt.md +20 -0
- package/dist/kpi/kstack/generated/skills/arena/SKILL.md +29 -0
- package/dist/kpi/kstack/generated/skills/blast-radius/SKILL.md +50 -0
- package/dist/kpi/kstack/generated/skills/bro/SKILL.md +7 -0
- package/dist/kpi/kstack/generated/skills/create-verification-skill/SKILL.md +44 -0
- package/dist/kpi/kstack/generated/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/dist/kpi/kstack/generated/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/dist/kpi/kstack/generated/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/dist/kpi/kstack/generated/skills/figure-it-out/SKILL.md +55 -0
- package/dist/kpi/kstack/generated/skills/how/SKILL.md +135 -0
- package/dist/kpi/kstack/generated/skills/how/references/critic-prompt.md +59 -0
- package/dist/kpi/kstack/generated/skills/how/references/critique-rubric.md +58 -0
- package/dist/kpi/kstack/generated/skills/how/references/explainer-prompt.md +55 -0
- package/dist/kpi/kstack/generated/skills/how/references/explorer-prompt.md +52 -0
- package/dist/kpi/kstack/generated/skills/interrogate/SKILL.md +113 -0
- package/dist/kpi/kstack/generated/skills/interrogate/references/code-quality-review.md +47 -0
- package/dist/kpi/kstack/generated/skills/interrogate/references/lead-judgment.md +58 -0
- package/dist/kpi/kstack/generated/skills/interrogate/references/reviewer-prompt.md +72 -0
- package/dist/kpi/kstack/generated/skills/interrogate/references/rubric.md +77 -0
- package/dist/kpi/kstack/generated/skills/k-agent/SKILL.md +17 -0
- package/dist/kpi/kstack/generated/skills/k-mode/SKILL.md +64 -0
- package/dist/kpi/kstack/generated/skills/k-stack-principles/SKILL.md +24 -0
- package/dist/kpi/kstack/generated/skills/maintain-verification-skill/SKILL.md +39 -0
- package/dist/kpi/kstack/generated/skills/no-comments/SKILL.md +24 -0
- package/dist/kpi/kstack/generated/skills/playbook-arena/SKILL.md +20 -0
- package/dist/kpi/kstack/generated/skills/playbook-autonomous-run/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/playbook-autopilot-full/SKILL.md +20 -0
- package/dist/kpi/kstack/generated/skills/playbook-autopilot-stack/SKILL.md +20 -0
- package/dist/kpi/kstack/generated/skills/playbook-bug-fix/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/playbook-feature/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/playbook-investigation/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/playbook-shipping/SKILL.md +18 -0
- package/dist/kpi/kstack/generated/skills/playbook-swarm/SKILL.md +20 -0
- package/dist/kpi/kstack/generated/skills/principle-boundary-discipline/SKILL.md +34 -0
- package/dist/kpi/kstack/generated/skills/principle-build-the-lever/SKILL.md +23 -0
- package/dist/kpi/kstack/generated/skills/principle-encode-lessons-in-structure/SKILL.md +31 -0
- package/dist/kpi/kstack/generated/skills/principle-exhaust-the-design-space/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/principle-experience-first/SKILL.md +19 -0
- package/dist/kpi/kstack/generated/skills/principle-fix-root-causes/SKILL.md +23 -0
- package/dist/kpi/kstack/generated/skills/principle-foundational-thinking/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/principle-guard-the-context-window/SKILL.md +17 -0
- package/dist/kpi/kstack/generated/skills/principle-laziness-protocol/SKILL.md +18 -0
- package/dist/kpi/kstack/generated/skills/principle-make-operations-idempotent/SKILL.md +24 -0
- package/dist/kpi/kstack/generated/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/principle-minimize-reader-load/SKILL.md +23 -0
- package/dist/kpi/kstack/generated/skills/principle-model-the-domain/SKILL.md +26 -0
- package/dist/kpi/kstack/generated/skills/principle-never-block-on-the-human/SKILL.md +23 -0
- package/dist/kpi/kstack/generated/skills/principle-outcome-oriented-execution/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/principle-prove-it-works/SKILL.md +33 -0
- package/dist/kpi/kstack/generated/skills/principle-redesign-from-first-principles/SKILL.md +16 -0
- package/dist/kpi/kstack/generated/skills/principle-separate-before-serializing-shared-state/SKILL.md +16 -0
- package/dist/kpi/kstack/generated/skills/principle-sequence-verifiable-units/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/principle-subtract-before-you-add/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/principle-type-system-discipline/SKILL.md +31 -0
- package/dist/kpi/kstack/generated/skills/recall/SKILL.md +35 -0
- package/dist/kpi/kstack/generated/skills/reflect/SKILL.md +77 -0
- package/dist/kpi/kstack/generated/skills/reflect/references/divergent-reviewer.md +43 -0
- package/dist/kpi/kstack/generated/skills/reflect/references/judgment-reviewer.md +42 -0
- package/dist/kpi/kstack/generated/skills/reflect/references/synthesizer.md +56 -0
- package/dist/kpi/kstack/generated/skills/reflect/references/tooling-reviewer.md +57 -0
- package/dist/kpi/kstack/generated/skills/setup-kstack/SKILL.md +48 -0
- package/dist/kpi/kstack/generated/skills/show-me-your-work/SKILL.md +82 -0
- package/dist/kpi/kstack/generated/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/dist/kpi/kstack/generated/skills/show-me-your-work/scripts/log.sh +40 -0
- package/dist/kpi/kstack/generated/skills/swarm/SKILL.md +27 -0
- package/dist/kpi/kstack/generated/skills/tdd/SKILL.md +44 -0
- package/dist/kpi/kstack/generated/skills/teach/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/technical-writing/SKILL.md +130 -0
- package/dist/kpi/kstack/generated/skills/typescript-best-practices/SKILL.md +30 -0
- package/dist/kpi/kstack/generated/skills/typescript-best-practices/references/patterns.md +313 -0
- package/dist/kpi/kstack/generated/skills/unslop/SKILL.md +81 -0
- package/dist/kpi/kstack/generated/skills/why/SKILL.md +230 -0
- package/dist/kpi/kstack/generated/skills/why/references/epistemics.md +144 -0
- package/dist/kpi/kstack/generated/skills/why/references/investigator-prompt.md +103 -0
- package/dist/kpi/kstack/generated/skills/why/references/source-playbook.md +17 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/code-archaeology.md +88 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/databricks.md +70 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/datadog.md +99 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/incident-postmortem.md +15 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/linear.md +48 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/notion.md +55 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/sentry.md +100 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/slack.md +54 -0
- package/dist/kpi/kstack/generated/skills/why/references/synthesizer-prompt.md +135 -0
- package/dist/kpi/kstack/model-ladder.md +50 -0
- package/dist/kpi/kstack/provenance.json +17 -0
- package/dist/kpi/prompts/implement.md +6 -0
- package/dist/kpi/prompts/plan.md +6 -0
- package/dist/kpi/prompts/review.md +6 -0
- package/dist/kpi/prompts/ship.md +6 -0
- package/dist/kpi/prompts/specify.md +6 -0
- package/dist/kpi/prompts/verify.md +6 -0
- package/dist/kpi/schemas/event.schema.json +1314 -0
- package/dist/kpi/schemas/evidence.schema.json +43 -0
- package/dist/kpi/schemas/stack.schema.json +102 -0
- package/dist/kpi/schemas/task.schema.json +165 -0
- package/dist/kpi/schemas/verdict.schema.json +44 -0
- package/dist/kpi/skills/concise-output/SKILL.md +10 -0
- package/dist/kpi/skills/context-pack/SKILL.md +10 -0
- package/dist/kpi/skills/conventional-commit/SKILL.md +12 -0
- package/dist/kpi/skills/isolated-review/SKILL.md +10 -0
- package/dist/kpi/skills/kg-claim/SKILL.md +26 -0
- package/dist/kpi/skills/minimalist/SKILL.md +24 -0
- package/dist/kpi/skills/quality-gates/SKILL.md +10 -0
- package/dist/kpi/skills/spec-first/SKILL.md +10 -0
- package/dist/kpi/skills/tdd-cycle/SKILL.md +10 -0
- package/dist/kpi/templates/AGENTS.md +31 -0
- package/dist/kpi/templates/APPEND_SYSTEM.md +13 -0
- package/dist/kpi/templates/context-pack/product.md +7 -0
- package/dist/kpi/templates/context-pack/structure.md +7 -0
- package/dist/kpi/templates/context-pack/tech.md +9 -0
- package/dist/kpi/templates/policy.json +17 -0
- package/dist/kpi/themes/loop-amber.json +82 -0
- package/dist/kpi/themes/protocol-blue.json +82 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/theme/dark.json +90 -0
- package/dist/modes/interactive/theme/light.json +89 -0
- package/dist/modes/interactive/theme/theme-schema.json +352 -0
- package/docs/compaction.md +418 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +777 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +156 -0
- package/docs/environment-variables.md +97 -0
- package/docs/extensions.md +3020 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +84 -0
- package/docs/json.md +98 -0
- package/docs/keybindings.md +236 -0
- package/docs/llama-cpp.md +101 -0
- package/docs/models.md +571 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +96 -0
- package/docs/providers.md +317 -0
- package/docs/quickstart.md +167 -0
- package/docs/rpc.md +1618 -0
- package/docs/sdk.md +1219 -0
- package/docs/security.md +59 -0
- package/docs/session-format.md +438 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +369 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +232 -0
- package/docs/terminal-setup.md +177 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +320 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +942 -0
- package/docs/usage.md +311 -0
- package/docs/windows.md +39 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +213 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +117 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +611 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/entry-renderer.ts +41 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +190 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/kimi-deferred-tools.ts +61 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +57 -0
- package/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +66 -0
- package/examples/extensions/plan-mode/index.ts +390 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +118 -0
- package/examples/extensions/question.ts +286 -0
- package/examples/extensions/questionnaire.ts +448 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +177 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +157 -0
- package/examples/extensions/subagent/index.ts +1038 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +199 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +641 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +75 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +99 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +74 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +140 -0
- package/package.json +55 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Architect runner prompt
|
|
2
|
+
|
|
3
|
+
The orchestrator passes this file through to every parallel candidate runner during Phase B and fills in the variable inputs around it: the task, the Phase A grounding artifacts, the isolated working directory, and the path to write outputs. The working directory is a git branch when available, otherwise a per-runner subdirectory under the sketch dir; what matters is independence between candidates.
|
|
4
|
+
|
|
5
|
+
You are producing one candidate design in architect's parallel exploration. Read the **architect** skill in full first; that's the workflow you're inside. Output a candidate design package: type sketch, function signatures, module map, and prose rationale shaped per [`rationale-template.md`](rationale-template.md).
|
|
6
|
+
|
|
7
|
+
Apply the following discipline. The orchestrator compares candidates on these axes to pick a base.
|
|
8
|
+
|
|
9
|
+
- Caller's usage first. Write the README-style usage and two or three real call sites before the types, then derive the type sketch from them. The usage is the spec; the two must agree, so reconcile the sketch to the usage, not the reverse.
|
|
10
|
+
- Data structures first. Get the core types right and the code becomes obvious. Trace each dominant access pattern through the proposed structure; if the answer is "we'll add a map / index / cache later," the structure is wrong.
|
|
11
|
+
- Interface depth. Compare the capability hidden behind the public surface relative to the size of that surface. Prefer a simple interface that pulls complexity into the callee, even when the implementation becomes less simple. Do not put transport or wire types on the public surface; parse into domain types behind the interface.
|
|
12
|
+
- Shared state: if two actors might both write, ask "what happens?" If the answer isn't "nothing," default to per-actor state with a merge at the read boundary, per the **separate-before-serializing-shared-state** principle skill.
|
|
13
|
+
- Make boundaries visible. `not implemented` errors for bodies, `// TODO` pseudocode for tricky logic, doc comments stating intent and invariants. A reader should trace data from input to output by reading types and signatures alone.
|
|
14
|
+
- Encode invariants in types: hard-to-misuse types > runtime checks > prose comments, per the **encode-lessons-in-structure** principle skill.
|
|
15
|
+
- Validate at boundaries, trust types inside, per the **boundary-discipline** principle skill. Business logic as pure functions; the shell stays thin.
|
|
16
|
+
- Single source of truth per invariant. Derive instead of sync.
|
|
17
|
+
- Idempotent state transitions where applicable, per the **make-operations-idempotent** principle skill. Ask what happens if the operation runs twice or crashes halfway.
|
|
18
|
+
- Short call chains. If tracing the flow needs more than three files, flatten the hierarchy, per the **laziness-protocol** and **minimize-reader-load** principle skills.
|
|
19
|
+
|
|
20
|
+
You are one of several runners, each on a different model. Produce the best design your model can make; don't hedge against the others. Differences between candidates are the signal used to pick a base and graft. Converging on a safe-looking middle defeats the exploration.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arena
|
|
3
|
+
description: Run at most two local K-π candidates against one frozen brief and graft the stronger result. Use for /arena, a bake-off, comparing two approaches, or picking between competing implementations.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Arena
|
|
8
|
+
|
|
9
|
+
Two attempts at the same brief, judged on their contract files.
|
|
10
|
+
|
|
11
|
+
1. **Freeze the brief.** Both workers receive the same text. A brief that changes
|
|
12
|
+
between workers compares two different questions.
|
|
13
|
+
2. **Pick the runners.** Take them from the `arena runners` list in
|
|
14
|
+
`~/.kpi/agent/kstack/models.json`. Prefer two different families so the
|
|
15
|
+
comparison is not one family reviewing its own habits. Only models the live
|
|
16
|
+
registry returned are eligible.
|
|
17
|
+
3. **Spawn at most two.** `spawn_background` with role `arena`, one worker per
|
|
18
|
+
runner. Two is the cap every K-π fan-out obeys, and only one worker may hold
|
|
19
|
+
the writer slot, so the second either reviews or waits.
|
|
20
|
+
4. **Steer with `communicate`.** Follow-up constraints go to the worker, not to a
|
|
21
|
+
shared scratch file.
|
|
22
|
+
5. **Judge the candidates.** Read each worker's `candidate.json` against the
|
|
23
|
+
frozen acceptance criteria. Never read a worker transcript.
|
|
24
|
+
6. **Graft the smallest proven result.** Take the winning candidate, or the
|
|
25
|
+
smallest combination that satisfies the criteria, and hand it to the shipping
|
|
26
|
+
gate. Never merge an origin branch and never push.
|
|
27
|
+
|
|
28
|
+
Every worker writes inside the current checkout on the job branch. There is no
|
|
29
|
+
second checkout, no remote runner, and no sleeper waiting for one to wake.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: blast-radius
|
|
3
|
+
description: "Find what a change could break somewhere else before it ships, beyond the diff, and prove the one fact it's safe because of by running real code instead of writing it up. Use for 'blast radius of X', 'what could this break', or reviewing a small diff you don't trust."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Blast radius
|
|
8
|
+
|
|
9
|
+
Find what a change breaks somewhere else, before it ships. Use for "blast radius of X", "what could this break", or reviewing a small diff you don't trust yet.
|
|
10
|
+
|
|
11
|
+
Companion to `how` and `why`. `how` tells you what the code does. `why` tells you why it's shaped that way. Blast radius tells you what it breaks somewhere else.
|
|
12
|
+
|
|
13
|
+
Listing the callers is not the job. The agent can grep those in a second. The job is the breakage grep won't show you.
|
|
14
|
+
|
|
15
|
+
## Don't trust your own writeup
|
|
16
|
+
|
|
17
|
+
A blast-radius writeup that sounds right is worthless. It reads as convincing whether or not it's true, and that is the trap you are walking into. So don't hand back the writeup. Find the one or two facts the whole thing depends on and prove them by running code. Words are where you start, not what you ship.
|
|
18
|
+
|
|
19
|
+
### How sure are you
|
|
20
|
+
|
|
21
|
+
For each fact the change's safety depends on, get it as far down this list as is cheap, and say where it stopped.
|
|
22
|
+
|
|
23
|
+
1. You said so. Worthless on its own.
|
|
24
|
+
2. You pointed at the line. A real `file:line`, or the library's own source.
|
|
25
|
+
3. You showed the bad case can't happen. You walked the failure step by step and it doesn't reach.
|
|
26
|
+
4. You ran it. A script or test that calls the real code and fails loud if you're wrong.
|
|
27
|
+
5. You reproduced it in the running app.
|
|
28
|
+
|
|
29
|
+
Any safety fact you can't get to step 4, say so out loud. Don't write it up as settled. Step 4 is usually one small script that imports the same library the app ships and calls the exact function you're worried about.
|
|
30
|
+
|
|
31
|
+
## Steps
|
|
32
|
+
|
|
33
|
+
1. Read the change. The diff, the symbols it adds, changes, and deletes, and what it now does differently, including the part the diff doesn't spell out. Use `why` step 2 to pull the PR and commits.
|
|
34
|
+
2. Find the one fact it's safe because of. Most changes that look scary are safe because of a single fact, like "this call only drops already-dead cache entries and does nothing else". Find that fact. If it holds, most of the scary cases die at once. Spend your time here, not on a long list of maybes.
|
|
35
|
+
3. Look where grep stops. Read the source of the library you call, and check its pinned version and any local patch. Work out when things run: microtasks, unmount and teardown, Solid versus React. Follow what a symbol search misses: the JSON an API returns, a DB column, a wire format, another language reading the same bytes, a feature flag, code three hops downstream.
|
|
36
|
+
4. Be honest about each risk. Give it a real chance of happening and a real cost if it does. Keep the risks you confirmed; list the ones you checked and cleared separately. Same rules as `why`. Cite a real `file:line`, a search that finds nothing is still an answer, and never make up a caller or an API.
|
|
37
|
+
5. Prove the one fact. Write a script or test that runs the real code, run it, and paste what happened. If you can't prove it cheaply, mark it unproven. Don't round up.
|
|
38
|
+
6. For a big or wide change, run it as an `arena`. Ask several models the same question and merge the answers. Different models catch different real bugs.
|
|
39
|
+
|
|
40
|
+
## What to hand back
|
|
41
|
+
|
|
42
|
+
- **What it does.** What changed, including the part that isn't obvious.
|
|
43
|
+
- **The one fact it's safe because of.** State it, say which step you got it to, and show the proof. If you couldn't prove it, write unproven.
|
|
44
|
+
- **Risks.** Only the real ones. Each names how it breaks, the `file:line`, how likely and how bad, and how to check. Paste the proof for the ones that matter.
|
|
45
|
+
- **Cleared.** What you checked and why it's fine.
|
|
46
|
+
- **Before you merge.** The cheapest test or repro that catches the real bug, including the script you wrote.
|
|
47
|
+
|
|
48
|
+
Write it through `unslop`, cite real code, and strip anything private before it goes anywhere public.
|
|
49
|
+
|
|
50
|
+
**Reply:** the writeup above, with the one safety fact either proven or marked unproven.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bro
|
|
3
|
+
description: Restate the last message in plain human language, with no jargon.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Restate your last message. Stop using jargon and speak coherently. State it more simply and concisely, like one human talking to another.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-verification-skill
|
|
3
|
+
description: "Generate a project-local verification skill that drives your app the way a user does — any language, framework, or platform. Use for /create-verification-skill, \"make a control skill for this repo\", or when a project has no scripted way to prove UI/CLI/service behavior."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Create a verification skill
|
|
8
|
+
|
|
9
|
+
Every serious project needs a scripted way to drive the real app and prove behavior: launch it, exercise a feature the way a user would, and capture evidence. This skill generates that as a project-local skill (`.kpi/skills/verify-<app>/`) tailored to the repo. You write the generator's output for the next agent, not for a human: it will be read cold, mid-task, by an agent that has never seen the app.
|
|
10
|
+
|
|
11
|
+
## 1. Interview the repo, not the user
|
|
12
|
+
|
|
13
|
+
Answer these from the codebase and only ask the user what you cannot observe:
|
|
14
|
+
|
|
15
|
+
- **Surface:** what does a user actually touch? A web UI, a CLI/TUI, a desktop app, an API, a mobile app, a library? A repo can have several; pick the primary one and note the rest.
|
|
16
|
+
- **Run:** how does the app start locally? Prefer the repo's own documented dev command (package scripts, Makefile, README quickstart). Note ports, env vars, seed data, auth.
|
|
17
|
+
- **Drive:** how can an agent interact with it programmatically? Existing harnesses first — Playwright/Cypress specs, expect scripts, PTY helpers, curl-able endpoints, a debug port. Only then pick a generic recipe: browser/CDP for web and Electron, a tmux/PTY harness for CLI/TUI, plain HTTP for services.
|
|
18
|
+
- **Observe:** what evidence can be captured? Screenshots, terminal transcripts, response bodies, logs, exit codes, DB state.
|
|
19
|
+
- **Isolate:** can two instances run side by side (ports, data dirs, profiles)? If not, say so in the generated skill: refusing to double-drive a shared instance beats corrupting the user's session.
|
|
20
|
+
|
|
21
|
+
If the checkout doesn't build or start as-is, fix that first (or report it precisely) before generating; a skill written against a broken base teaches wrong steps. When an irrelevant missing asset blocks startup (a static dir the API never serves, a sample config), the generated skill may create it, clearly marked as verification scaffolding, and remove it in cleanup.
|
|
22
|
+
|
|
23
|
+
## 2. Generate the skill
|
|
24
|
+
|
|
25
|
+
Write `.kpi/skills/verify-<app>/SKILL.md` with YAML frontmatter (`name: verify-<app>` and a `description` that names the app, the surface, and when to reach for it — without frontmatter the skill never registers) and these sections, each grounded in what the interview actually found (no placeholders left):
|
|
26
|
+
|
|
27
|
+
- **Launch:** the exact command that starts the app for verification, and how to tell it's ready (a log line, a port answering, a prompt). Include teardown. For a short-lived CLI or TUI there is no server to keep alive: launch means build the binary (or install deps) once, then start each drive in its own isolated PTY or tmux session.
|
|
28
|
+
- **Doctor:** one read-only check that answers "is this instance worth driving?" — process up, right version/build, port owned by us, auth valid. An agent runs this first whenever anything looks off.
|
|
29
|
+
- **Drive:** the harness recipe with real selectors/commands from this repo, not examples. Prefer stable handles (ARIA labels, data attributes, prompt strings, route paths) over coordinates and tab order.
|
|
30
|
+
- **Evidence:** what to capture for a proof and where it goes. State the proof standards: exercise the real user path, not internal setters or test-only endpoints; capture the action and the resulting state, not just the final screen; verify side effects (files written, rows inserted, messages sent) alongside what's visible; mocks only where a production boundary already isolates the external system. When the safe path is a dry-run or test mode, verify what it actually skips by observing (files, network, git refs) rather than trusting its name: some dry-runs still touch the network or open a browser.
|
|
31
|
+
- **Cleanup:** how to tear down instances the run created. Never kill by process name; kill what you started. Cleanup removes instances and scratch state, never the evidence: proof artifacts survive the teardown, in a location the skill names.
|
|
32
|
+
- **Helpers:** any script the skill ships is executable and its invocation is shown in the skill body. A helper the reader has to reverse-engineer is not a helper.
|
|
33
|
+
|
|
34
|
+
## 3. Seed the feature map
|
|
35
|
+
|
|
36
|
+
Create `.kpi/skills/verify-<app>/features/README.md` plus one file per user-facing feature you can identify (aim for the top 3-5 to start, from routes, commands, menus, or docs). Follow the shape in [`references/feature-map-example/`](references/feature-map-example/), with a README index and one file per feature. Each file answers, from the user's point of view: what the feature is, how to reach it, how to drive it with the harness, and what observable end state proves it works. The four H2s are `Sub-features`, `How to get to it (user POV)`, `Driving it with <harness>`, and `Gotchas`. The map is the repo's maintained verification source; a proof that drives one convenient entry point is incomplete when the map lists others.
|
|
37
|
+
|
|
38
|
+
## 4. Prove the generated skill before handing it over
|
|
39
|
+
|
|
40
|
+
Run its own instructions end to end once: launch, doctor, drive ONE mapped feature (one is enough; the map exists so later runs can cover the rest), capture evidence, clean up. After cleanup, confirm the evidence still exists at the named location — a cleanup that eats the proof fails this step. Fix what fails, and run the generated cleanup after every failed iteration too, so broken attempts don't strand processes and ports. A generated skill that was never executed is a draft, not a deliverable.
|
|
41
|
+
|
|
42
|
+
## 5. Offer the maintenance loop
|
|
43
|
+
|
|
44
|
+
Point the user at `/maintain-verification-skill` for keeping the map honest as the app changes. Suggest a cadence only if they ask.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Notes verification map
|
|
2
|
+
|
|
3
|
+
This directory is the maintained source for verifying the user-facing behavior of Notes. Read the index before driving the app, then use the matching feature file as the recipe.
|
|
4
|
+
|
|
5
|
+
## Baseline preconditions
|
|
6
|
+
|
|
7
|
+
- Launch Notes at `http://127.0.0.1:4173` with a disposable data directory.
|
|
8
|
+
- Set `NOTES_DATA_DIR=/tmp/notes-verify-$RUN_ID` so concurrent runs do not share state.
|
|
9
|
+
- Seed notes titled `Quarterly plan` and `Grocery list`.
|
|
10
|
+
- Put `control-notes` and the `notes` CLI on `PATH`.
|
|
11
|
+
- Run `control-notes doctor` and require the expected URL, data directory, and build revision.
|
|
12
|
+
- Never drive an instance that was not started by this verification run.
|
|
13
|
+
|
|
14
|
+
## Driving conventions
|
|
15
|
+
|
|
16
|
+
- Start every recipe from the baseline state unless its preconditions say otherwise.
|
|
17
|
+
- Prefer ARIA roles and accessible names over CSS selectors or DOM position.
|
|
18
|
+
- Treat every command as literal. Keep quoted names and flags unchanged.
|
|
19
|
+
- Run browser actions through `control-notes browser`.
|
|
20
|
+
- Run terminal actions through `control-notes cli -- <command>`.
|
|
21
|
+
- Restore seeded data after a mutation. Do not remove proof artifacts during cleanup.
|
|
22
|
+
|
|
23
|
+
## Proof and skip reporting
|
|
24
|
+
|
|
25
|
+
- Capture the user action and the resulting state, not only the final screen.
|
|
26
|
+
- UI proof includes an ARIA snapshot and a screenshot with the app identity visible.
|
|
27
|
+
- CLI proof includes the command, stdout, stderr, and exit code.
|
|
28
|
+
- Mutation proof includes a read-only second view of the stored value.
|
|
29
|
+
- Record the feature ID and entry point used with every artifact.
|
|
30
|
+
- Report an unreachable path with the attempted command and the unmet precondition.
|
|
31
|
+
- Do not report a skipped entry point as verified through a different path.
|
|
32
|
+
|
|
33
|
+
## Feature entry contract
|
|
34
|
+
|
|
35
|
+
Each feature file starts with an H1 title and one paragraph describing the user-visible behavior. It then uses exactly four H2 sections in this order.
|
|
36
|
+
|
|
37
|
+
1. `Sub-features` lists short IDs with one line for each behavior.
|
|
38
|
+
2. `How to get to it (user POV)` lists every user entry point.
|
|
39
|
+
3. `Driving it with <harness>` starts with `Preconditions:` and uses labeled bullets that pair each user action with an exact command and observable result.
|
|
40
|
+
4. `Gotchas` lists traps that can waste or invalidate a verification run.
|
|
41
|
+
|
|
42
|
+
Keep implementation details out of the map. Name only user paths, stable handles, required state, commands, and observable proof.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- [Create a note](./create-note.md) covers browser and CLI creation, cancellation, persistence, and cleanup.
|
|
47
|
+
- [Search notes](./search.md) covers toolbar, keyboard, and CLI search with matching, empty, and clear states.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Create a note
|
|
2
|
+
|
|
3
|
+
Create note lets a user save a titled note from the browser or CLI, cancel an unfinished draft, and confirm the saved note from a second user-facing view.
|
|
4
|
+
|
|
5
|
+
## Sub-features
|
|
6
|
+
|
|
7
|
+
- `create-open` opens a blank editor from each browser entry point.
|
|
8
|
+
- `create-save` persists a title and body.
|
|
9
|
+
- `create-cancel` discards an unfinished browser draft.
|
|
10
|
+
- `create-cli` creates the same note shape from the terminal.
|
|
11
|
+
|
|
12
|
+
## How to get to it (user POV)
|
|
13
|
+
|
|
14
|
+
- Choose the `New note` button in the browser toolbar.
|
|
15
|
+
- Press `n` in the browser while focus is outside an editable field.
|
|
16
|
+
- Run `notes create --title <title> --body <body>` in a terminal.
|
|
17
|
+
|
|
18
|
+
## Driving it with control-notes
|
|
19
|
+
|
|
20
|
+
Preconditions:
|
|
21
|
+
|
|
22
|
+
- Notes is healthy at `http://127.0.0.1:4173`.
|
|
23
|
+
- No note is titled `Release checklist`.
|
|
24
|
+
- `control-notes doctor` reports the expected URL and disposable data directory.
|
|
25
|
+
|
|
26
|
+
- **Open editor.** Choose `New note`. Run `control-notes browser click --role button --name "New note"`. A form named `Note editor` appears with focus in the `Title` textbox.
|
|
27
|
+
- **Enter content.** Type the title and body. Run `control-notes browser fill --role textbox --name "Title" --value "Release checklist"` and `control-notes browser fill --role textbox --name "Body" --value "Tag and publish"`. The `Save note` button becomes enabled.
|
|
28
|
+
- **Save note.** Choose `Save note`. Run `control-notes browser click --role button --name "Save note"`. A status named `Note saved` appears and the heading reads `Release checklist`.
|
|
29
|
+
- **Confirm persistence.** Return to the note list and reopen the note. Run `control-notes browser click --role link --name "All notes"` and `control-notes browser click --role link --name "Release checklist"`. The editor shows both saved values.
|
|
30
|
+
- **Cancel draft.** Open a new note, enter `Discard me`, and choose `Cancel`. Run `control-notes browser click --role button --name "New note"`, `control-notes browser fill --role textbox --name "Title" --value "Discard me"`, and `control-notes browser click --role button --name "Cancel"`. The note list returns and has no `Discard me` link.
|
|
31
|
+
- **CLI entry.** Create a second note. Run `control-notes cli -- notes create --title "CLI note" --body "Created from terminal" --format json`. Exit code `0` and stdout contain the new note ID and title.
|
|
32
|
+
- **Proof.** Reopen both saved notes from `All notes`. Run `control-notes browser snapshot --aria --path artifacts/create-note/list.aria.txt` and `control-notes browser screenshot --path artifacts/create-note/list.png`. The artifacts show `Release checklist` and `CLI note`.
|
|
33
|
+
|
|
34
|
+
## Gotchas
|
|
35
|
+
|
|
36
|
+
- Pressing `n` while a textbox has focus types the character instead of opening a new editor.
|
|
37
|
+
- Titles are trimmed on save. Assert the rendered title, not the draft input value.
|
|
38
|
+
- A save status alone is insufficient proof. Reopen the note from the list.
|
|
39
|
+
- Remove `Release checklist` and `CLI note` during fixture cleanup, but retain their proof artifacts.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Search notes
|
|
2
|
+
|
|
3
|
+
Search lets a user find notes by title or body text, inspect a matching note, and distinguish no matches from an unavailable search.
|
|
4
|
+
|
|
5
|
+
## Sub-features
|
|
6
|
+
|
|
7
|
+
- `search-open` opens search from each supported browser entry point.
|
|
8
|
+
- `search-match` returns title and body matches without changing note data.
|
|
9
|
+
- `search-open-result` opens a result in the note editor.
|
|
10
|
+
- `search-empty` shows a complete empty state for a query with no matches.
|
|
11
|
+
- `search-clear` removes the query and restores the recent-notes view.
|
|
12
|
+
- `search-cli` returns the same matching notes from the terminal.
|
|
13
|
+
|
|
14
|
+
## How to get to it (user POV)
|
|
15
|
+
|
|
16
|
+
- Choose the `Search` button in the browser toolbar.
|
|
17
|
+
- Press `/` in the browser while focus is outside an editable field.
|
|
18
|
+
- Run `notes search <query>` in a terminal.
|
|
19
|
+
|
|
20
|
+
## Driving it with control-notes
|
|
21
|
+
|
|
22
|
+
Preconditions:
|
|
23
|
+
|
|
24
|
+
- Notes is healthy at `http://127.0.0.1:4173`.
|
|
25
|
+
- The disposable data directory contains `Quarterly plan` with body text `Draft budget`.
|
|
26
|
+
- `control-notes doctor` reports the expected URL and data directory.
|
|
27
|
+
|
|
28
|
+
- **Toolbar entry.** Choose the `Search` button. Run `control-notes browser click --role button --name "Search"`. A dialog named `Search notes` appears with focus in its searchbox.
|
|
29
|
+
- **Keyboard entry.** Close the dialog, focus the page, and press `/`. Run `control-notes browser press --key "/"`. The same dialog appears and the page does not insert a slash.
|
|
30
|
+
- **Title match.** Type `quarterly`. Run `control-notes browser fill --role searchbox --name "Search notes" --value "quarterly"`. The `Search results` list contains `Quarterly plan` and does not contain `Grocery list`.
|
|
31
|
+
- **Body match.** Replace the query with `budget`. Run `control-notes browser fill --role searchbox --name "Search notes" --value "budget"`. The result `Quarterly plan` remains visible with a body-match excerpt.
|
|
32
|
+
- **Open result.** Choose `Quarterly plan`. Run `control-notes browser click --role link --name "Quarterly plan"`. The dialog closes and the editor heading reads `Quarterly plan`.
|
|
33
|
+
- **Empty state.** Reopen search and enter `volcano`. Run `control-notes browser fill --role searchbox --name "Search notes" --value "volcano"`. A status named `No matching notes` appears after search completes.
|
|
34
|
+
- **Clear query.** Choose `Clear search`. Run `control-notes browser click --role button --name "Clear search"`. The searchbox is empty and the `Recent notes` region replaces the result list.
|
|
35
|
+
- **CLI match.** Search from the terminal. Run `control-notes cli -- notes search "quarterly" --format json`. Exit code `0` and stdout contain one object whose title is `Quarterly plan`.
|
|
36
|
+
- **CLI miss.** Search for an absent value. Run `control-notes cli -- notes search "volcano" --format json`. Exit code `0` and stdout are `[]`.
|
|
37
|
+
- **Proof.** Capture the populated result state. Run `control-notes browser snapshot --aria --path artifacts/search/results.aria.txt` and `control-notes browser screenshot --path artifacts/search/results.png`. Both artifacts identify Notes, the query, and `Quarterly plan`.
|
|
38
|
+
|
|
39
|
+
## Gotchas
|
|
40
|
+
|
|
41
|
+
- Pressing `/` while the editor or searchbox has focus inserts text instead of opening search.
|
|
42
|
+
- Results update after a short debounce. Wait for the results list or empty status, not a fixed sleep.
|
|
43
|
+
- Archived notes are excluded unless the user enables `Include archived`.
|
|
44
|
+
- The CLI defaults to human-readable output. Use `--format json` for stable assertions.
|
|
45
|
+
- Opening a result changes browser state. Reopen search before proving another query.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: figure-it-out
|
|
3
|
+
description: "Design an auditable playbook when no narrower one fits: a large migration, an ambitious multi-part change, or work a human reviews after stepping away. Scales rigor to the task, runs a hypothesis loop, and logs decisions via show-me-your-work. Use for /figure-it-out, 'figure it out', a large migration, or when no narrower playbook applies."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Figure it out
|
|
8
|
+
|
|
9
|
+
When the task matches no playbook, design one. The deliverable before any code is the workflow itself: a sequence of phases that scales rigor to the task, runs the scientific method, and leaves a decision trail a human can audit after stepping away. Bias toward more rigor. The cost of building the wrong thing dwarfs the cost of being careful.
|
|
10
|
+
|
|
11
|
+
Don't reinvent a playbook you already have. A focused single-unit task that matches Bug fix, Perf, Feature, Visual parity, Eval, or Multi-phase plan routes there. But a large or cross-cutting version of one (a migration across many call sites, an ambitious multi-part change), or work the user reviews after stepping away, belongs here even though a single-unit version would be a Feature. The rigor and the audit trail are the point.
|
|
12
|
+
|
|
13
|
+
## Start
|
|
14
|
+
|
|
15
|
+
Open a todolist whose first item is to read the Principles section of the **k-mode** skill. Then add the phases below as todos.
|
|
16
|
+
|
|
17
|
+
## Phase A: Frame
|
|
18
|
+
|
|
19
|
+
Ground first, then commit. Don't start the run until you can state:
|
|
20
|
+
|
|
21
|
+
- The definition of done as a falsifiable predicate (the **prove-it-works** principle skill). "Done well" has to be checkable.
|
|
22
|
+
- Scope, quantified: rough units and effort, plus the blockers grounding surfaced. Raise them before spending hours, not after fifty doomed commits.
|
|
23
|
+
- The rigor level, biased high. One-way doors and high blast radius get more; reversible low-stakes steps get less. Rigor is gates and artifacts, not "try harder".
|
|
24
|
+
|
|
25
|
+
Present the framing and tradeoffs before committing to a long run. Reversible work proceeds (the **never-block-on-the-human** principle skill), but a multi-hour run earns one checkpoint.
|
|
26
|
+
|
|
27
|
+
## Phase B: Design the workflow
|
|
28
|
+
|
|
29
|
+
Decompose into atomic, independently-landable units. Sequence riskiest-unknown-first so option value stays high. Scaffold and verification come before features (the **foundational-thinking** principle skill).
|
|
30
|
+
|
|
31
|
+
- Build the verification harness before the work, with the baseline captured from the pre-change state, so the check reads as "old value vs new value".
|
|
32
|
+
- For one-way-door design decisions, run the **architect** skill (it runs **arena**) with diverse, isolated, opinionated candidates and a read-only judge on a different model family. Skip it for mechanical work whose shape is already concrete. A second arena over a settled design is over-engineering (the **laziness-protocol** principle skill).
|
|
33
|
+
- Decide what fans out. Parallelize only across genuine seams, and give each worker its own branch (the **separate-before-serializing-shared-state** principle skill). Don't over-fan.
|
|
34
|
+
- Write the designed phase list down. That list is what the human reviews.
|
|
35
|
+
|
|
36
|
+
Then put the design into motion. Add its steps to the todolist as concrete items, after the Phase C entry and before Phase D. Run each under the Phase C loop discipline, and weave the Phase D log through them, a row as each step lands, rather than saving the whole trail for the end.
|
|
37
|
+
|
|
38
|
+
## Phase C: Run the loop
|
|
39
|
+
|
|
40
|
+
Each unit is an experiment: state the hypothesis, make the smallest change, measure against the predicate on the real artifact, keep it if it advanced, revert it if it didn't.
|
|
41
|
+
Apply the **sequence-verifiable-units** principle skill, verifying each unit before starting the next instead of batching checks at the end.
|
|
42
|
+
|
|
43
|
+
- Verify by inspecting the artifact, never a self-report. When something passes too easily, suspect the observation method before the system. A blank screenshot passes a lazy gate.
|
|
44
|
+
- Pair delegated work with a judge and audit the delegates' artifacts yourself before trusting them. If a worker games the gate, reset and harden the contract. If the gate itself is wrong, fix the gate in its own change rather than routing around it.
|
|
45
|
+
- A verdict is VERIFIED, NOT VERIFIED, or INCONCLUSIVE. Inconclusive is not a pass. Don't hide a negative.
|
|
46
|
+
|
|
47
|
+
## Phase D: Keep the audit trail
|
|
48
|
+
|
|
49
|
+
Log the run via the **show-me-your-work** skill, one canonical TSV with a row per decision and per unit, evidence as links. figure-it-out's work is usually ambitious enough to commit the trail so the reviewer can read it in the PR; commit it when confidence has to be shown. Prefer evidence produced by committed scripts so a reviewer can re-run it. The trail plus the diff is what lets the human come back and trust the work.
|
|
50
|
+
|
|
51
|
+
## Phase E: Verify and hand back
|
|
52
|
+
|
|
53
|
+
Check the whole against the Phase A predicate on the real product, not just the harness. Encode any recurring correction as a gate, a lint rule, a check, or a script, so the win can't silently regress (the **encode-lessons-in-structure** principle skill).
|
|
54
|
+
|
|
55
|
+
**Reply:** the playbook you designed, the rigor level and why, the decision-trail path, what's verified against the predicate, and what's still open.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: how
|
|
3
|
+
description: "Use for \"how does X work\", code walkthroughs before changing something, and placement / ownership / layering questions (\"where should this live\", \"which package owns this\", \"is this the right layer\"). Explains subsystem architecture, runtime flow, onboarding mental models. Can critique architecture. Use why for motivation."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# How
|
|
8
|
+
|
|
9
|
+
Explore the codebase to answer "how does X work?" questions. Produce clear architectural explanations at the level of a senior engineer onboarding onto a subsystem. Enough to build a working mental model, not annotated source code.
|
|
10
|
+
|
|
11
|
+
Two modes:
|
|
12
|
+
|
|
13
|
+
1. **Explain** (default). Explore the codebase and produce a clear explanation
|
|
14
|
+
2. **Critique.** Explain first, then spawn multiple models to independently identify architectural issues
|
|
15
|
+
|
|
16
|
+
## Explain Mode
|
|
17
|
+
|
|
18
|
+
### Step 1. Understand the Question and Assess Complexity
|
|
19
|
+
|
|
20
|
+
Parse what the user is asking about:
|
|
21
|
+
|
|
22
|
+
- "How does the rate limiter work?", a subsystem
|
|
23
|
+
- "How do we handle billing for on-demand usage?", a feature flow
|
|
24
|
+
- "How is the auth service structured?", an architectural overview
|
|
25
|
+
- "Walk me through what happens when a user submits a form", a runtime trace
|
|
26
|
+
|
|
27
|
+
Identify the scope. If ambiguous, state your best-guess interpretation before exploring. Don't ask. Let the user redirect if you're off.
|
|
28
|
+
|
|
29
|
+
**Assess complexity to decide the approach:**
|
|
30
|
+
|
|
31
|
+
- **Simple** (a single module, a small utility, a narrow question like "how does function X work"): skip explorer agents; the explainer explores and explains in a single pass. Go to Step 2b.
|
|
32
|
+
- **Complex** (a subsystem spanning multiple files/services, a cross-cutting feature, a full architectural overview): spawn parallel explorer agents first, then hand off to the explainer. Go to Step 2a.
|
|
33
|
+
|
|
34
|
+
When in doubt, lean simple. You can always spawn explorers if the explainer hits a wall.
|
|
35
|
+
|
|
36
|
+
### Step 2a. Explore (complex questions only)
|
|
37
|
+
|
|
38
|
+
Decompose the question into 2-4 parallel exploration angles, each a distinct slice of the subsystem so explorers don't duplicate work. Example split for "how does the rate limiter work?":
|
|
39
|
+
|
|
40
|
+
- Explorer 1: data model and state management
|
|
41
|
+
- Explorer 2: request path and enforcement
|
|
42
|
+
- Explorer 3: configuration and metrics infrastructure
|
|
43
|
+
|
|
44
|
+
The right decomposition depends on the question. Use your judgment. Narrow questions: 2 explorers is fine. Broad subsystems: up to 4.
|
|
45
|
+
|
|
46
|
+
Spawn all explorers in a single message:
|
|
47
|
+
|
|
48
|
+
- `role`: `generalPurpose`
|
|
49
|
+
- `model`: your configured how-explorer model (roles resolved from `~/.kpi/agent/kstack/models.json`, set by `/setup-kstack`)
|
|
50
|
+
- `readonly`: `true`
|
|
51
|
+
|
|
52
|
+
Each explorer gets the same base prompt from `references/explorer-prompt.md` plus a specific exploration angle naming its slice. Each explorer should:
|
|
53
|
+
- Start broad: Glob for relevant directories, Grep for key types/interfaces/class names
|
|
54
|
+
- Follow the thread: from an entry point, trace the call chain (callers, callees, data flow, type definitions)
|
|
55
|
+
- Read the actual code, don't guess from file names
|
|
56
|
+
- Stop when it can describe the full path from input to output (or trigger to effect) without hand-waving any step
|
|
57
|
+
- Note things that are surprising, non-obvious, or that a newcomer would get wrong
|
|
58
|
+
|
|
59
|
+
Each explorer returns structured findings: components found, flow traced, files read, anything non-obvious. Overlap between explorers is fine; the explainer reconciles.
|
|
60
|
+
|
|
61
|
+
Then proceed to Step 3.
|
|
62
|
+
|
|
63
|
+
### Step 2b. Direct Explain (simple questions)
|
|
64
|
+
|
|
65
|
+
Spawn a single background K-π worker that explores and explains in one pass:
|
|
66
|
+
|
|
67
|
+
- `role`: `generalPurpose`
|
|
68
|
+
- `model`: your configured how-explainer model (roles resolved from `~/.kpi/agent/kstack/models.json`, set by `/setup-kstack`)
|
|
69
|
+
- `readonly`: `true`
|
|
70
|
+
|
|
71
|
+
The agent does its own exploration (Glob, Grep, Read) and writes the explanation directly. Read `references/explainer-prompt.md` for the communication style and output format. Same structure, just no explorer findings as input.
|
|
72
|
+
|
|
73
|
+
Proceed to Step 4.
|
|
74
|
+
|
|
75
|
+
### Step 3. Synthesize (complex questions only)
|
|
76
|
+
|
|
77
|
+
Once all explorers return, spawn a single background K-π worker to synthesize their findings into one coherent explanation:
|
|
78
|
+
|
|
79
|
+
- `role`: `generalPurpose`
|
|
80
|
+
- `model`: your configured how-explainer model (roles resolved from `~/.kpi/agent/kstack/models.json`, set by `/setup-kstack`)
|
|
81
|
+
- `readonly`: `true`
|
|
82
|
+
|
|
83
|
+
The explainer gets all explorers' findings and writes the human-facing explanation (output format below). Read `references/explainer-prompt.md` for the full prompt template. The explainer reconciles overlapping findings, resolves contradictions, and weaves the slices into a unified picture.
|
|
84
|
+
|
|
85
|
+
### Step 4. Present
|
|
86
|
+
|
|
87
|
+
Present the explainer's output to the user. You may lightly edit for clarity or add context from the conversation, but don't substantially rewrite. The explainer's communication is the product.
|
|
88
|
+
|
|
89
|
+
### Output Format
|
|
90
|
+
|
|
91
|
+
Follow this structure, adapted to the question. Not every section is needed for every question.
|
|
92
|
+
|
|
93
|
+
**Overview.** 1-2 paragraphs. What it is, what it does, why it exists. Enough to decide whether to keep reading.
|
|
94
|
+
|
|
95
|
+
**Key Concepts.** The important types, services, or abstractions. Brief definition of each. Not exhaustive, just the ones needed to understand the rest.
|
|
96
|
+
|
|
97
|
+
**How It Works.** The core of the explanation. Walk through the flow: what triggers it, what happens step by step, where data goes, the decision points. Prose, not pseudocode. Reference specific files and functions so the reader can go look, but don't dump code blocks unless a snippet is genuinely necessary.
|
|
98
|
+
|
|
99
|
+
**Where Things Live.** A brief map of the relevant files/directories. Not every file, just the ones needed to start working in this area.
|
|
100
|
+
|
|
101
|
+
**Gotchas.** Non-obvious or surprising things that would trip someone up. Historical context that explains why something looks weird. Known sharp edges.
|
|
102
|
+
|
|
103
|
+
## Critique Mode
|
|
104
|
+
|
|
105
|
+
Triggered when the user asks for architectural issues, problems, or improvements, not just understanding.
|
|
106
|
+
|
|
107
|
+
### Step 1. Explain First
|
|
108
|
+
|
|
109
|
+
Run the full explain flow above (Steps 1-4). You must understand the architecture before critiquing it.
|
|
110
|
+
|
|
111
|
+
### Step 2. Spawn Critics
|
|
112
|
+
|
|
113
|
+
After the explanation is complete, spawn one architectural critic per model in your configured how-critics list (roles resolved from `~/.kpi/agent/kstack/models.json`, set by `/setup-kstack`), all in a single message.
|
|
114
|
+
|
|
115
|
+
For each critic:
|
|
116
|
+
- `role`: `generalPurpose`
|
|
117
|
+
- `model`: one model from the configured how-critics list. These are minimum reasoning levels. The lead should escalate any model when the architecture warrants deeper analysis.
|
|
118
|
+
- `readonly`: `true`
|
|
119
|
+
|
|
120
|
+
Read `references/critic-prompt.md` for the prompt template. Each critic gets:
|
|
121
|
+
1. The explanation from Step 1 (so they don't re-explore)
|
|
122
|
+
2. The relevant file paths (so they can read the actual code)
|
|
123
|
+
3. The architectural critique rubric from `references/critique-rubric.md`
|
|
124
|
+
|
|
125
|
+
### Step 3. Lead Judgment
|
|
126
|
+
|
|
127
|
+
Same framework as the interrogate skill. You're a pragmatic lead, not an aggregator.
|
|
128
|
+
|
|
129
|
+
Categorize findings:
|
|
130
|
+
- **Act on.** Architectural problems worth fixing now
|
|
131
|
+
- **Consider.** Real concerns, but the cost/benefit is unclear
|
|
132
|
+
- **Noted.** Valid observations, low priority
|
|
133
|
+
- **Dismissed.** Wrong, missing context, or style preference
|
|
134
|
+
|
|
135
|
+
Present the explanation first (from Step 1), then the critique verdict below it. The explanation should stand on its own; someone who just wants to understand the system shouldn't wade through critique.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Critic Prompt Template
|
|
2
|
+
|
|
3
|
+
Build each critic background K-π worker's prompt from this template. Fill in the placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are reviewing the architecture of a codebase subsystem. An explanation of how it works has already been written. Read it to orient yourself, then read the actual code to form your own judgment.
|
|
8
|
+
|
|
9
|
+
## Architectural Explanation
|
|
10
|
+
|
|
11
|
+
{EXPLANATION}
|
|
12
|
+
|
|
13
|
+
## Relevant Files
|
|
14
|
+
|
|
15
|
+
{FILE_PATHS}
|
|
16
|
+
|
|
17
|
+
## Critique Rubric
|
|
18
|
+
|
|
19
|
+
{CRITIQUE_RUBRIC_CONTENTS}
|
|
20
|
+
|
|
21
|
+
## Instructions
|
|
22
|
+
|
|
23
|
+
Read the files listed above. Use the explanation as a map, but form your own opinions from the code itself. The explanation might miss things or frame them charitably.
|
|
24
|
+
|
|
25
|
+
Find architectural problems, not line-level bugs or style issues. Ask whether this subsystem is built well for what it needs to do and how it will need to evolve.
|
|
26
|
+
|
|
27
|
+
For each finding:
|
|
28
|
+
|
|
29
|
+
1. **Severity**: `structural` | `concern` | `observation`
|
|
30
|
+
- `structural`: a fundamental architectural problem. Wrong abstraction boundary, broken data model, coupling that will block future work
|
|
31
|
+
- `concern`: a real issue that makes the system harder to work with or reason about, but not fundamentally broken
|
|
32
|
+
- `observation`: worth noting. A tradeoff that might not age well, a pattern inconsistent with the rest of the codebase, technical debt
|
|
33
|
+
2. **Finding**: the architectural issue. Be specific. Name the components, the boundary, the coupling.
|
|
34
|
+
3. **Evidence**: concrete code that demonstrates the problem. Don't just assert that "this is too coupled". Show the dependency chain.
|
|
35
|
+
4. **Impact**: what the issue costs. Harder to test? Harder to change? Performance cliff at scale? Be concrete about the consequence.
|
|
36
|
+
|
|
37
|
+
## What to Avoid
|
|
38
|
+
|
|
39
|
+
- Line-level code review (not your job here)
|
|
40
|
+
- Suggesting rewrites without demonstrating a problem with the current approach
|
|
41
|
+
- "This could use more abstraction" without showing what the abstraction would actually solve
|
|
42
|
+
- Flagging intentional tradeoffs with clear benefits as issues
|
|
43
|
+
|
|
44
|
+
If the architecture is sound, say so. An empty critique is a valid outcome.
|
|
45
|
+
|
|
46
|
+
## Output
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
## Findings
|
|
50
|
+
|
|
51
|
+
### 1. [Severity] Short title
|
|
52
|
+
**Components**: Which parts of the system are involved
|
|
53
|
+
**Finding**: What's wrong architecturally
|
|
54
|
+
**Evidence**: Concrete code references
|
|
55
|
+
**Impact**: What this costs in practice
|
|
56
|
+
|
|
57
|
+
### 2. [Severity] Short title
|
|
58
|
+
...
|
|
59
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Architectural Critique Rubric
|
|
2
|
+
|
|
3
|
+
Review through whichever of these lenses are relevant. Not every lens applies to every subsystem.
|
|
4
|
+
|
|
5
|
+
## Abstraction Fit
|
|
6
|
+
|
|
7
|
+
Are the abstractions pulling their weight?
|
|
8
|
+
|
|
9
|
+
- Does each abstraction represent a real concept, or is it an indirection layer "in case we need it"?
|
|
10
|
+
- Are the boundaries in the right place? Do they separate things that change independently?
|
|
11
|
+
- Is there accidental coupling where components share implementation details they shouldn't need to know about?
|
|
12
|
+
- Is business logic entangled with framework wiring, or cleanly separated?
|
|
13
|
+
|
|
14
|
+
Over-abstraction is as much a problem as under-abstraction. A flat, simple design is fine when the domain is simple.
|
|
15
|
+
|
|
16
|
+
## Data Model
|
|
17
|
+
|
|
18
|
+
Do the data structures fit the actual usage patterns?
|
|
19
|
+
|
|
20
|
+
- Are the data models designed for how data is actually accessed, or for how it was conceptually modeled?
|
|
21
|
+
- Are there impedance mismatches, places where code constantly reshapes data because the model doesn't match the access pattern?
|
|
22
|
+
- Are types honest? Do they represent what data actually looks like at runtime, or claim more structure than exists?
|
|
23
|
+
|
|
24
|
+
## Boundary Discipline
|
|
25
|
+
|
|
26
|
+
Are system boundaries clean and well-placed?
|
|
27
|
+
|
|
28
|
+
- Is validation concentrated at entry points, or scattered through internal code?
|
|
29
|
+
- Are errors handled at boundaries and propagated cleanly, or caught and re-thrown at every layer?
|
|
30
|
+
- Does data cross boundaries in well-typed shapes, or as bags of optional fields?
|
|
31
|
+
- Could this subsystem be tested in isolation, or does it require the entire system to be running?
|
|
32
|
+
|
|
33
|
+
## Evolution Readiness
|
|
34
|
+
|
|
35
|
+
How well will this architecture handle likely changes?
|
|
36
|
+
|
|
37
|
+
- If the most probable next requirement landed tomorrow, how much would change? "One file" or "everything"?
|
|
38
|
+
- Are there hardcoded assumptions that would need to be relaxed?
|
|
39
|
+
- Is the design bolted-on (integrated as an afterthought) or integrated (looks like it was always part of the plan)?
|
|
40
|
+
- Are legacy paths preserved for compatibility that no one depends on?
|
|
41
|
+
|
|
42
|
+
Don't penalize for not handling hypothetical changes. Focus on changes plausible given the codebase's trajectory.
|
|
43
|
+
|
|
44
|
+
## Complexity vs. Value
|
|
45
|
+
|
|
46
|
+
Is the complexity budget spent wisely?
|
|
47
|
+
|
|
48
|
+
- Is complexity concentrated in the parts that need it (core logic, tricky invariants) or in accidental places (boilerplate, unnecessary indirection, configuration)?
|
|
49
|
+
- Are there simpler ways to achieve the same behavior?
|
|
50
|
+
- Does every component earn its existence, or are there vestigial pieces from an earlier design?
|
|
51
|
+
|
|
52
|
+
## Consistency
|
|
53
|
+
|
|
54
|
+
Does this subsystem follow the patterns established elsewhere in the codebase?
|
|
55
|
+
|
|
56
|
+
- Are similar problems solved the same way here as elsewhere, or does this area invent its own patterns?
|
|
57
|
+
- If the patterns differ, is there a good reason, or did it just evolve independently?
|
|
58
|
+
- Inconsistency isn't automatically bad. But unexplained inconsistency is a maintenance burden.
|