@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,417 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"id": "coding-loop.gated",
|
|
4
|
+
"entry": "ac-compiler",
|
|
5
|
+
"nodes": [
|
|
6
|
+
{
|
|
7
|
+
"id": "ac-compiler",
|
|
8
|
+
"type": "agent",
|
|
9
|
+
"prompt": "Check the frozen task contract and acceptance quality before execution. Do not change repository files.",
|
|
10
|
+
"context": {
|
|
11
|
+
"mode": "isolated"
|
|
12
|
+
},
|
|
13
|
+
"tools": [
|
|
14
|
+
"read",
|
|
15
|
+
"grep",
|
|
16
|
+
"find",
|
|
17
|
+
"ls"
|
|
18
|
+
],
|
|
19
|
+
"readOnly": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "specify",
|
|
23
|
+
"type": "agent",
|
|
24
|
+
"prompt": "Apply the spec-first skill. Research the repository and specify requirements, design, tasks, constraints, and non-goals before implementation. Do not change production files.",
|
|
25
|
+
"context": {
|
|
26
|
+
"mode": "isolated"
|
|
27
|
+
},
|
|
28
|
+
"tools": [
|
|
29
|
+
"read",
|
|
30
|
+
"grep",
|
|
31
|
+
"find",
|
|
32
|
+
"ls"
|
|
33
|
+
],
|
|
34
|
+
"readOnly": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "plan",
|
|
38
|
+
"type": "agent",
|
|
39
|
+
"prompt": "Produce an implementation plan and a Dune stack.json of module boundaries from the frozen task, research, and specification. Return only JSON matching stack.schema.json (the graph engine writes stack.json). Do not change production files.",
|
|
40
|
+
"context": {
|
|
41
|
+
"mode": "isolated"
|
|
42
|
+
},
|
|
43
|
+
"tools": [
|
|
44
|
+
"read",
|
|
45
|
+
"grep",
|
|
46
|
+
"find",
|
|
47
|
+
"ls"
|
|
48
|
+
],
|
|
49
|
+
"readOnly": true,
|
|
50
|
+
"response": {
|
|
51
|
+
"path": "stack.json",
|
|
52
|
+
"schema": "stack.schema.json",
|
|
53
|
+
"retries": 1,
|
|
54
|
+
"state": {}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": "plan-check",
|
|
59
|
+
"type": "agent",
|
|
60
|
+
"prompt": "Verify the frozen plan still matches the repository and has executable tasks and bounds. Do not respecify or change files.",
|
|
61
|
+
"context": {
|
|
62
|
+
"mode": "isolated"
|
|
63
|
+
},
|
|
64
|
+
"tools": [
|
|
65
|
+
"read",
|
|
66
|
+
"grep",
|
|
67
|
+
"find",
|
|
68
|
+
"ls"
|
|
69
|
+
],
|
|
70
|
+
"readOnly": true
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "implement",
|
|
74
|
+
"type": "agent",
|
|
75
|
+
"prompt": "Apply the tdd-cycle skill. Apply the minimalist skill. Before production changes, write candidate.json.ladder, declare runtime dependencies, and capture failing test output. Implement only the current stack.json module and the smallest change satisfying the frozen acceptance criteria. Never write verdict.json or release.approved.",
|
|
76
|
+
"context": {
|
|
77
|
+
"mode": "thread",
|
|
78
|
+
"threadKey": "coder"
|
|
79
|
+
},
|
|
80
|
+
"tools": [
|
|
81
|
+
"read",
|
|
82
|
+
"grep",
|
|
83
|
+
"find",
|
|
84
|
+
"ls",
|
|
85
|
+
"bash",
|
|
86
|
+
"edit",
|
|
87
|
+
"write"
|
|
88
|
+
],
|
|
89
|
+
"readOnly": false
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "test",
|
|
93
|
+
"type": "agent",
|
|
94
|
+
"prompt": "Apply the quality-gates skill. Run the exact task.json quality_gates and acceptance checks, then return HEAD-bound evidence. Do not claim green when any required command fails.",
|
|
95
|
+
"context": {
|
|
96
|
+
"mode": "isolated"
|
|
97
|
+
},
|
|
98
|
+
"tools": [
|
|
99
|
+
"read",
|
|
100
|
+
"bash"
|
|
101
|
+
],
|
|
102
|
+
"readOnly": false,
|
|
103
|
+
"response": {
|
|
104
|
+
"path": "evidence.json",
|
|
105
|
+
"schema": "evidence.schema.json",
|
|
106
|
+
"retries": 1,
|
|
107
|
+
"state": {
|
|
108
|
+
"evidence.head": "head"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": "review",
|
|
114
|
+
"type": "agent",
|
|
115
|
+
"prompt": "Apply the isolated-review skill. Review the candidate and fresh evidence against every required acceptance criterion. Publish a schema-valid verdict.json through write_contract; do not change repository files and do not treat assistant transcript as the verdict.",
|
|
116
|
+
"context": {
|
|
117
|
+
"mode": "isolated"
|
|
118
|
+
},
|
|
119
|
+
"tools": [
|
|
120
|
+
"read",
|
|
121
|
+
"grep",
|
|
122
|
+
"find",
|
|
123
|
+
"ls"
|
|
124
|
+
],
|
|
125
|
+
"readOnly": true,
|
|
126
|
+
"workerRole": "reviewer",
|
|
127
|
+
"response": {
|
|
128
|
+
"path": "verdict.json",
|
|
129
|
+
"schema": "verdict.schema.json",
|
|
130
|
+
"retries": 0,
|
|
131
|
+
"state": {
|
|
132
|
+
"review.approved": "approved",
|
|
133
|
+
"review.status": "status",
|
|
134
|
+
"review.output_fingerprint": "output_fingerprint"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "human",
|
|
140
|
+
"type": "human",
|
|
141
|
+
"title": "Approve gated release",
|
|
142
|
+
"question": "All quality gates and isolated review are green. Approve this change for commit?",
|
|
143
|
+
"statePath": "release.approved"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "ship",
|
|
147
|
+
"type": "agent",
|
|
148
|
+
"prompt": "Apply the conventional-commit skill. Create exactly one approved commit whose subject matches ^(feat|fix|docs|refactor|test|chore)(\\(.+\\))?: and whose message ends with this exact trailer line, with no quoting or punctuation around it:\nKPI-Job: {{job_id}}\nThat trailer is how the control plane recognises this job's commit, so it must appear exactly once. Never push.",
|
|
149
|
+
"context": {
|
|
150
|
+
"mode": "thread",
|
|
151
|
+
"threadKey": "ship"
|
|
152
|
+
},
|
|
153
|
+
"tools": [
|
|
154
|
+
"bash"
|
|
155
|
+
],
|
|
156
|
+
"readOnly": false
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"id": "unsafe",
|
|
160
|
+
"type": "terminal",
|
|
161
|
+
"status": "UNSAFE",
|
|
162
|
+
"reason": "a write left the task's declared bounds"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"id": "needs-human",
|
|
166
|
+
"type": "terminal",
|
|
167
|
+
"status": "NEEDS_HUMAN",
|
|
168
|
+
"reason": "the review reported an untestable blocking issue, or the receipts are no longer fresh"
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"edges": [
|
|
172
|
+
{
|
|
173
|
+
"from": "ac-compiler",
|
|
174
|
+
"to": "specify",
|
|
175
|
+
"when": {
|
|
176
|
+
"path": "plan.provided",
|
|
177
|
+
"equals": false
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"from": "ac-compiler",
|
|
182
|
+
"to": "plan-check",
|
|
183
|
+
"when": {
|
|
184
|
+
"path": "plan.provided",
|
|
185
|
+
"equals": true
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"from": "specify",
|
|
190
|
+
"to": "plan"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"from": "plan",
|
|
194
|
+
"to": "implement"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"from": "plan-check",
|
|
198
|
+
"to": "implement"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"from": "implement",
|
|
202
|
+
"to": "test"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"from": "test",
|
|
206
|
+
"to": "unsafe",
|
|
207
|
+
"when": {
|
|
208
|
+
"path": "bounds.held",
|
|
209
|
+
"equals": false
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"from": "test",
|
|
214
|
+
"to": "implement",
|
|
215
|
+
"when": [
|
|
216
|
+
{
|
|
217
|
+
"path": "bounds.held",
|
|
218
|
+
"equals": true
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"path": "test.passed",
|
|
222
|
+
"equals": false
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"from": "test",
|
|
228
|
+
"to": "review",
|
|
229
|
+
"when": [
|
|
230
|
+
{
|
|
231
|
+
"path": "bounds.held",
|
|
232
|
+
"equals": true
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"path": "test.passed",
|
|
236
|
+
"equals": true
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"from": "review",
|
|
242
|
+
"to": "unsafe",
|
|
243
|
+
"when": {
|
|
244
|
+
"path": "bounds.held",
|
|
245
|
+
"equals": false
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"from": "review",
|
|
250
|
+
"to": "human",
|
|
251
|
+
"when": [
|
|
252
|
+
{
|
|
253
|
+
"path": "bounds.held",
|
|
254
|
+
"equals": true
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"path": "review.approved",
|
|
258
|
+
"equals": true
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"path": "test.passed",
|
|
262
|
+
"equals": true
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"path": "fingerprints.fresh",
|
|
266
|
+
"equals": true
|
|
267
|
+
}
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"from": "review",
|
|
272
|
+
"to": "needs-human",
|
|
273
|
+
"when": [
|
|
274
|
+
{
|
|
275
|
+
"path": "bounds.held",
|
|
276
|
+
"equals": true
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"path": "review.approved",
|
|
280
|
+
"equals": true
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"path": "test.passed",
|
|
284
|
+
"equals": false
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"from": "review",
|
|
290
|
+
"to": "needs-human",
|
|
291
|
+
"when": [
|
|
292
|
+
{
|
|
293
|
+
"path": "bounds.held",
|
|
294
|
+
"equals": true
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"path": "review.approved",
|
|
298
|
+
"equals": true
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"path": "fingerprints.fresh",
|
|
302
|
+
"equals": false
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"from": "review",
|
|
308
|
+
"to": "implement",
|
|
309
|
+
"when": [
|
|
310
|
+
{
|
|
311
|
+
"path": "bounds.held",
|
|
312
|
+
"equals": true
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"path": "review.approved",
|
|
316
|
+
"equals": false
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"path": "review.status",
|
|
320
|
+
"equals": "REVISE"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"from": "review",
|
|
326
|
+
"to": "needs-human",
|
|
327
|
+
"when": [
|
|
328
|
+
{
|
|
329
|
+
"path": "bounds.held",
|
|
330
|
+
"equals": true
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"path": "review.approved",
|
|
334
|
+
"equals": false
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"path": "review.status",
|
|
338
|
+
"equals": "BLOCKED"
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"from": "human",
|
|
344
|
+
"to": "ship",
|
|
345
|
+
"when": [
|
|
346
|
+
{
|
|
347
|
+
"path": "release.approved",
|
|
348
|
+
"equals": true
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"path": "ship.shipped",
|
|
352
|
+
"equals": false
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"from": "human",
|
|
358
|
+
"to": "__end__",
|
|
359
|
+
"when": [
|
|
360
|
+
{
|
|
361
|
+
"path": "release.approved",
|
|
362
|
+
"equals": true
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"path": "ship.shipped",
|
|
366
|
+
"equals": true
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"from": "human",
|
|
372
|
+
"to": "implement",
|
|
373
|
+
"when": [
|
|
374
|
+
{
|
|
375
|
+
"path": "release.approved",
|
|
376
|
+
"equals": false
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"path": "policy.onHumanDeny",
|
|
380
|
+
"equals": "revise"
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"from": "human",
|
|
386
|
+
"to": "__end__",
|
|
387
|
+
"when": [
|
|
388
|
+
{
|
|
389
|
+
"path": "release.approved",
|
|
390
|
+
"equals": false
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"path": "policy.onHumanDeny",
|
|
394
|
+
"equals": "end"
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"from": "ship",
|
|
400
|
+
"to": "__end__"
|
|
401
|
+
}
|
|
402
|
+
],
|
|
403
|
+
"limits": {
|
|
404
|
+
"maxSteps": 24,
|
|
405
|
+
"maxNodeRuns": 16,
|
|
406
|
+
"maxConcurrency": 2,
|
|
407
|
+
"maxCostUsd": 5,
|
|
408
|
+
"timeoutMs": 1800000
|
|
409
|
+
},
|
|
410
|
+
"policy": {
|
|
411
|
+
"allowNonInteractive": false,
|
|
412
|
+
"allowNonInteractiveMutations": false,
|
|
413
|
+
"confirmProjectGraph": true,
|
|
414
|
+
"confirmMutatingNodes": true,
|
|
415
|
+
"onHumanDeny": "revise"
|
|
416
|
+
}
|
|
417
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"id": "spec-first",
|
|
4
|
+
"entry": "specify",
|
|
5
|
+
"nodes": [
|
|
6
|
+
{
|
|
7
|
+
"id": "specify",
|
|
8
|
+
"type": "agent",
|
|
9
|
+
"prompt": "Apply the spec-first skill. Research the repository and produce requirements, design, tasks, constraints, non-goals, and executable acceptance criteria without changing production files.",
|
|
10
|
+
"context": { "mode": "isolated" },
|
|
11
|
+
"tools": ["read", "grep", "find", "ls"],
|
|
12
|
+
"readOnly": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "plan",
|
|
16
|
+
"type": "agent",
|
|
17
|
+
"prompt": "Turn the approved specification into ordered vertical slices and stack.json module boundaries without changing production files.",
|
|
18
|
+
"context": { "mode": "isolated" },
|
|
19
|
+
"tools": ["read", "grep", "find", "ls"],
|
|
20
|
+
"readOnly": true
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"edges": [
|
|
24
|
+
{ "from": "specify", "to": "plan" },
|
|
25
|
+
{ "from": "plan", "to": "__end__" }
|
|
26
|
+
],
|
|
27
|
+
"limits": {
|
|
28
|
+
"maxSteps": 4,
|
|
29
|
+
"maxNodeRuns": 2,
|
|
30
|
+
"maxConcurrency": 1,
|
|
31
|
+
"maxCostUsd": 2,
|
|
32
|
+
"timeoutMs": 900000
|
|
33
|
+
},
|
|
34
|
+
"policy": {
|
|
35
|
+
"allowNonInteractive": false,
|
|
36
|
+
"allowNonInteractiveMutations": false,
|
|
37
|
+
"confirmProjectGraph": true,
|
|
38
|
+
"confirmMutatingNodes": true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
K-stack includes adaptations of pstack by Lauren Tan (@poteto), originally distributed in Cursor's plugins repository under the MIT License.
|
|
2
|
+
|
|
3
|
+
Copyright (c) Lauren Tan and Cursor contributors.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, to deal in the Software without restriction, subject to the conditions of the MIT License.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# K-stack upstream
|
|
2
|
+
|
|
3
|
+
| Source | https://github.com/cursor/plugins.git |
|
|
4
|
+
|---|---|
|
|
5
|
+
| Path | pstack/ |
|
|
6
|
+
| Commit | efa2a531985e0a8084d36ff3cf87233be8a9f34b |
|
|
7
|
+
| pstack tree | 1c625329e71538629f087374daa71293a498089f |
|
|
8
|
+
| Upstream version | main snapshot 2026-08-31 |
|
|
9
|
+
| K-stack overlay | 1 |
|
|
10
|
+
|
|
11
|
+
`provenance.json` beside this file is the machine-readable record: the same origin, commit and
|
|
12
|
+
`pstack/` tree id, plus the transform version, the ordered patch digests, and the licence
|
|
13
|
+
provenance. Both files move together, and only `npm run kstack:sync -- --pin <sha>` moves them.
|
|
14
|
+
|
|
15
|
+
Drift is a tree, not a HEAD. `npm run kstack:sync:check` is offline: it rebuilds from the
|
|
16
|
+
vendored `upstream/` subtree and fails on byte drift, on a semantic diagnostic, or on a pin
|
|
17
|
+
whose recorded tree id no longer matches those bytes. `npm run kstack:status` reports whether
|
|
18
|
+
upstream has moved and never changes the pin.
|
|
19
|
+
|
|
20
|
+
Generated content is produced by `npm run kstack:sync`; runtime package loading never fetches
|
|
21
|
+
the network.
|
|
22
|
+
|
|
23
|
+
Pinned-deps (`scripts/check-pinned-deps.mjs`) excludes the vendored `upstream/` path only — a byte-for-byte mirror that keeps loose specs (e.g. `skills/poteto-mode/scripts/package.json` with `bun-types`/`typescript: "latest"`); `generated/` ships no `package.json`, and the overlay drops or pins any such manifests before emit.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lauren Tan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architect
|
|
3
|
+
description: "Sketch types, signatures, and module structure before code, then stay in the loop while implementation fills in. Use for /architect, 'architect this', 'design this', or non-trivial work where jumping to code would lock in the wrong shape."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Architect
|
|
8
|
+
|
|
9
|
+
Design before implementing. Sketch types, function signatures, class shapes, and module boundaries with `not implemented` bodies and pseudocode. Synthesize across multiple model perspectives, then fill in code against the chosen sketch. If implementation proves the sketch wrong, throw it out and redesign.
|
|
10
|
+
|
|
11
|
+
## Start
|
|
12
|
+
|
|
13
|
+
Open a todolist with one entry per phase before starting. Autonomous mode without checkpoints needs the list to show phase position and keep phases from silently disappearing.
|
|
14
|
+
|
|
15
|
+
1. Ground
|
|
16
|
+
2. Sketch
|
|
17
|
+
3. Agree
|
|
18
|
+
4. Implement
|
|
19
|
+
5. Scrap
|
|
20
|
+
|
|
21
|
+
## Phase A: Ground the problem
|
|
22
|
+
|
|
23
|
+
Build a real mental model of every system the new code touches. Run the **how** skill over the relevant subsystems. Critique mode if existing structure is the constraint or the design must push back on it.
|
|
24
|
+
|
|
25
|
+
Naming a file isn't grounding. Produce the traced model `how` prescribes. If the design redefines ownership or layering, also run the **why** skill on the existing shape so the rationale becomes a constraint, not a guess.
|
|
26
|
+
|
|
27
|
+
Skip Phase A only when the work is genuinely greenfield with no surrounding system to integrate.
|
|
28
|
+
|
|
29
|
+
## Phase B: Sketch
|
|
30
|
+
|
|
31
|
+
Run the **arena** skill with the design-sketch task and the Phase A grounding artifacts. Pass `references/runner-prompt.md` as each runner's prompt. Each candidate produces a design package shaped per `references/rationale-template.md`: the caller's usage written first, then the type sketch, function signatures, module map, and prose rationale derived from it.
|
|
32
|
+
|
|
33
|
+
Use your configured architect runners (roles resolved from `~/.kpi/agent/kstack/models.json`, set by `/setup-kstack`).
|
|
34
|
+
|
|
35
|
+
Design it twice. Require at least two structurally distinct candidates before synthesis, even when the first looks sufficient. This is the **exhaust-the-design-space** principle skill made concrete. Whole-shape alternatives, not point fixes inside one shape.
|
|
36
|
+
|
|
37
|
+
Screen every candidate against [`references/design-red-flags.md`](references/design-red-flags.md) before synthesis. Reject or revise shallow modules, information leakage, temporal decomposition, and pass-through methods.
|
|
38
|
+
|
|
39
|
+
Compare viable candidates on interface depth. Prefer the design that hides more complexity behind a smaller, simpler public surface. A rich interface can keep call chains short by concentrating capability instead of scattering it across layers.
|
|
40
|
+
|
|
41
|
+
Arena returns one synthesized design package. The synthesis decision populates the rationale's "Synthesis decision" section.
|
|
42
|
+
|
|
43
|
+
## Phase C: Agree (opt-in)
|
|
44
|
+
|
|
45
|
+
Default: proceed directly to implementation with the synthesized design. No human checkpoint.
|
|
46
|
+
|
|
47
|
+
Opt in to a checkpoint when the invoker explicitly asks: "/architect with checkpoint," "stop and show me before implementing," or similar. Then surface the synthesized design and pause for sign-off.
|
|
48
|
+
|
|
49
|
+
The synthesis can ship as its own commit either way. That's the "scaffold first" mode of the **foundational-thinking** principle skill; subsequent commits read as filling in bodies against a stable contract. Planned and scoped breakage during fill-in is fine, per the **outcome-oriented-execution** principle skill. For adversarial pressure on the design before implementing, run the **interrogate** skill on the synthesized sketch.
|
|
50
|
+
|
|
51
|
+
If the human pushes back on the shape (in a checkpoint or after the fact), treat that as Phase A evidence. Re-ground and re-run Phase B before writing more code.
|
|
52
|
+
|
|
53
|
+
## Phase D: Implement against the sketch
|
|
54
|
+
|
|
55
|
+
Replace `not implemented` bodies with code, pseudocode with logic. The synthesized sketch is the contract.
|
|
56
|
+
|
|
57
|
+
Deviations from the sketch are signal worth surfacing, not friction to absorb silently. If a function needs a parameter the sketch didn't anticipate, ask whether the sketch was wrong, the requirement was missed, or the implementation is overreaching. Surface it; don't bolt it on.
|
|
58
|
+
|
|
59
|
+
## Phase E: Scrap when the architecture is wrong
|
|
60
|
+
|
|
61
|
+
If implementation keeps producing friction the sketch can't absorb, throw the sketch out. Don't bolt fixes onto a wrong design, per the **redesign-from-first-principles** and **fix-root-causes** principle skills.
|
|
62
|
+
|
|
63
|
+
The signal is a *pattern*, not single instances. Tells:
|
|
64
|
+
|
|
65
|
+
- The same shape of workaround appearing repeatedly across unrelated code.
|
|
66
|
+
- Multiple unrelated edge cases that all need special-case branches.
|
|
67
|
+
- Types that need escape hatches (`any`, casts, optional fields always set in practice) to compile.
|
|
68
|
+
- The "we need a lock" reflex when the sketch said the state wasn't shared.
|
|
69
|
+
- Callers having to know the abstraction's internal rules to use it.
|
|
70
|
+
- Two or more independent Phase D deviations of the same shape across the implementation. Surfacing deviations is Phase D's job; a repeated pattern of them is Phase E's trigger.
|
|
71
|
+
|
|
72
|
+
Use judgment. A few edge cases don't condemn an architecture. Some problems are legitimately complex; complexity in the data is not complexity in the design. The rewrite signal is repeated friction of the same shape, not single hard cases.
|
|
73
|
+
|
|
74
|
+
When you scrap:
|
|
75
|
+
|
|
76
|
+
1. Re-run the **how** skill over what's been built. The implementation lessons enter the new design as inputs, not vibes.
|
|
77
|
+
2. Redesign as if the new constraints had been day-one assumptions, per redesign-from-first-principles.
|
|
78
|
+
3. Subtract before adding, per the **subtract-before-you-add** principle skill. The new sketch should be smaller than the old one before it grows.
|
|
79
|
+
4. Return to Phase B and re-run arena.
|
|
80
|
+
|
|
81
|
+
## Outputs
|
|
82
|
+
|
|
83
|
+
The caller's usage is written first and the type sketch derived from it. One file with new types and signatures for small changes; module map plus type definitions for larger work. The rationale ships alongside, shaped per `references/rationale-template.md`, including the usage sketch and the synthesis decision.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Design red flags
|
|
2
|
+
|
|
3
|
+
Screen every candidate before synthesis. A red flag is a reason to revise or reject the shape.
|
|
4
|
+
|
|
5
|
+
## Shallow module
|
|
6
|
+
|
|
7
|
+
A shallow module exposes a large interface while hiding little complexity. Judge depth by the capability and policy hidden behind the public surface relative to the size of that surface. Prefer a simple interface backed by substantial behavior.
|
|
8
|
+
|
|
9
|
+
Do not confuse a deep module with a deep call chain. A deep call chain scatters understanding across layers. A deep module concentrates capability behind one interface.
|
|
10
|
+
|
|
11
|
+
Look for these signs:
|
|
12
|
+
|
|
13
|
+
- Callers coordinate several methods to complete one operation.
|
|
14
|
+
- Public options expose internal stages or implementation choices.
|
|
15
|
+
- Learning the interface does not save the caller from learning the implementation.
|
|
16
|
+
|
|
17
|
+
## Information leakage
|
|
18
|
+
|
|
19
|
+
Information leakage makes multiple modules depend on the same internal decision. A representation, policy, or protocol detail appears in more than one place, so changing it requires coordinated edits.
|
|
20
|
+
|
|
21
|
+
Public re-exports of transport or wire types are leakage. Parse external data into domain types behind the interface. Keep storage schemas, framework objects, and protocol details private.
|
|
22
|
+
|
|
23
|
+
## Temporal decomposition
|
|
24
|
+
|
|
25
|
+
Temporal decomposition organizes modules by execution order instead of the knowledge they own. Separate load, validate, transform, and save stages often repeat one representation and its invariants across several boundaries.
|
|
26
|
+
|
|
27
|
+
Group code around domain knowledge and ownership. Methods that run at different times can still belong to one module when they protect the same decisions.
|
|
28
|
+
|
|
29
|
+
## Pass-through method
|
|
30
|
+
|
|
31
|
+
A pass-through method forwards the same arguments to another method with the same shape. It adds a layer without hiding complexity.
|
|
32
|
+
|
|
33
|
+
Remove it or move responsibility to the module that can complete the operation. Keep a forwarding boundary only when it adds policy, adaptation, or a distinct abstraction.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Rationale template
|
|
2
|
+
|
|
3
|
+
The prose that ships alongside the type sketch. One page. Sentence-case headings, no boilerplate. Replace the italic notes with actual content.
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
*One paragraph. What we're trying to do, and what about the existing system or constraints makes the shape non-obvious. If [Phase A](../SKILL.md#phase-a-ground-the-problem) surfaced constraints the design must honor (existing types to interop with, callers we can't break, invariants that crossed our boundary), name them here so the reader sees the same constraints you saw.*
|
|
8
|
+
|
|
9
|
+
## Usage (caller's view)
|
|
10
|
+
|
|
11
|
+
*Write this first, before the type sketch. Show the README or quickstart the consumer reads, plus two or three realistic call sites in their own code. What they import, what they call, what comes back. The type sketch in [Shape](#shape) is derived from this. The two must agree; when they diverge, reconcile the sketch to the usage, not the reverse. The caller's experience is the spec. The types serve it.*
|
|
12
|
+
|
|
13
|
+
## Shape
|
|
14
|
+
|
|
15
|
+
*The recommended architecture. Data structures first; then how data flows through the signatures. Name the load-bearing decisions. State which invariants are encoded in types, where validation lives, and what the system deliberately does not do. Judge interface depth explicitly. State what complexity the public surface hides, what remains exposed to callers, and why the interface is no larger than needed. Cite the principle behind each decision (e.g., `per boundary-discipline`); don't restate it.*
|
|
16
|
+
|
|
17
|
+
## Synthesis decision
|
|
18
|
+
|
|
19
|
+
*Filled in by [arena](../../arena/SKILL.md). Records which candidate became the base and why, what was adapted from each of the others, and what was rejected and why.*
|
|
20
|
+
|
|
21
|
+
## Tradeoffs accepted
|
|
22
|
+
|
|
23
|
+
*One bullet per tradeoff the chosen shape makes. Form: "we accept X in exchange for Y." Name anything a future reader might mistake for an oversight, including things that look like premature optimization or premature simplification.*
|
|
24
|
+
|
|
25
|
+
## Alternatives considered
|
|
26
|
+
|
|
27
|
+
*Required. Name at least one concrete alternative shape, with one line on why it lost. Judge each alternative on interface depth, not implementation simplicity alone. Name the complexity it exposes to callers and the complexity it hides. Two or three alternatives belong here when the design space had real contenders. One is fine when the constraints forced the answer, with the conclusion phrased as "this was the only viable shape because..." Avoid listing flavors of the same shape. This section covers design alternatives the chosen shape considered and rejected, not other runner candidates.*
|
|
28
|
+
|
|
29
|
+
## Open questions and risks
|
|
30
|
+
|
|
31
|
+
*Things you noticed during the sketch that the human needs to weigh in on, and risks worth flagging before implementation starts. Phrase as questions, not assertions, so the human's answer is the resolution rather than a comment.*
|
|
32
|
+
|
|
33
|
+
## Next implementation step
|
|
34
|
+
|
|
35
|
+
*The first thing to build against the sketch. One sentence. What you'd start writing immediately after synthesis (or after Phase D sign-off, if a checkpoint was opted into).*
|