docks-kit 0.6.0 → 0.7.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/AGENTS.md CHANGED
@@ -15,9 +15,9 @@ Tool-specific instructions live alongside this file:
15
15
  | Path | Purpose |
16
16
  |------|---------|
17
17
  | `docks-kit` | CLI launcher: runs the compiled binary in `cli/dist/` when present, otherwise Bun-from-source (auto-installs Bun + `node_modules`). No-Bun recovery is the platform release binary |
18
- | `cli/src/engine-native/` | EngineNative implementation for `sync`, `model`, and `toolchain`; idempotent, flag-gated for destructive reconciliation |
18
+ | `cli/src/engine-native/` | EngineNative implementation for `sync`, `model`, `workflow`, and `toolchain`; idempotent, flag-gated for destructive reconciliation |
19
19
  | `cli/` | Effect-TS CLI + bundled docs topics |
20
- | `SoT/models.json` | Kit-verified model catalog |
20
+ | `SoT/models.json` | Kit-verified model catalog plus the strict Docks workflow-role registry |
21
21
  | `SoT/toolchain.json` | Toolchain floors manifest (verified pins consumed by EngineNative) |
22
22
  | `SoT/.claude/bin/` | Dependency-free Bun runtime programs for Claude's statusline, SessionStart, and Notification |
23
23
  | `install.sh` | Global installer |
@@ -36,6 +36,7 @@ Codex SoT notes:
36
36
  - `SoT/.codex/rules/*.rules` deploys to `~/.codex/rules/` as kit-managed Codex command policy. This is Codex's equivalent of permission allow/prompt/block rules; user-learned approvals in `~/.codex/rules/default.rules` are preserved.
37
37
  - `SoT/.codex/plugins/marketplace.json` deploys to Codex's personal marketplace path at `~/.agents/plugins/marketplace.json`; when the `codex` CLI is available, sync reruns `codex plugin add <plugin@marketplace>` for enabled SoT plugins so stale cached installs are refreshed.
38
38
  - `docks-kit status` verifies Session Relay only through the supported `codex plugin list --json` inventory. `ready` means installed and enabled for a newly started Codex session; it is not evidence about an old process, lifecycle state, receive-path health, or worker quiescence. The global prompt SoTs carry the owner's standing authorization for Docks cross-company plan review, which never overrides host or platform denial.
39
+ - Both global prompt SoTs carry one byte-identical compact `Docks-workflow-models:` record. Root `--model-orchestrator` / `--model-reviewer` / `--model-implementer` / review-bound flags update only that deployed record; `docks-kit models workflow` lists the closed selectors, and a flag-less sync restores defaults.
39
40
  - The `codex` CLI binary is upstream-owned, not kit-owned. The official standalone installer keeps package metadata under `$CODEX_HOME/packages/standalone` and places the `codex` symlink in `~/.local/bin` by default; sync only warns with a download-then-run installer command when the CLI is missing. Existing installs can self-update with `codex update`; npm and Homebrew remain upstream alternatives.
40
41
  - `SoT/.codex/AGENTS.md` deliberately does not import `@RTK.md`: RTK's published Codex integration is prompt-file based rather than hook based, so importing it leaks implementation detail into agent-visible context. Use Codex hooks for RTK only after the kit installs a hook-backed Codex integration.
41
42
  - Claude runtime settings are an authoring template with sentinels. `claudeRuntime.ts` materializes absolute Bun/script paths only after the shared `bun.ts` bootstrap is ready; `claudeSync.ts` writes all runtime assets before atomically committing settings, then prunes the legacy shell scripts and Stop hook. Native `rate_limits` is the sole quota source, so jq/curl/OAuth caches are not runtime dependencies. A missing Bun defers only this cutover and preserves legacy pointers/files.
@@ -86,10 +87,10 @@ When a kit-mechanic skill, its `references/`, or a wrapper agent (`.claude/agent
86
87
  ## Plans
87
88
 
88
89
  <constraint>
89
- Multi-commit work plans live in `docs/plans/active/` (status is a frontmatter field) and `docs/plans/finished/` (archive). Every plan file is a complete handoff document — `goal`, `Steps`, `Acceptance criteria`, `Review` — so any agent can pick one up cold. Skills handle every operation: `plan-init` (bootstrap/migrate), `plan-manager` (list/show/start/block/ship/new, auto-commit on transition, self-review on draft), `plan-review` (verification). Trigger by natural language or the matching `plan-*` skill. `active/` is multi-occupancy.
90
+ Multi-commit work plans live in `docs/plans/active/` (status is a frontmatter field) and `docs/plans/finished/` (archive). Every plan file is a complete cold-handoff document — goal, context & rationale, environment & how-to-run, steps with exact paths, executable acceptance criteria, and a binary cold-handoff checklist — so any agent (or a weaker model) can pick one up cold without guessing. Skills handle every operation: `plan-init` (bootstrap/migrate), `plan-manager` (list/show/start/block/ship/new, auto-commit on transition, self-review on draft), `plan-review` (verification). Trigger by natural language or the matching `plan-*` skill. `active/` is multi-occupancy.
90
91
  </constraint>
91
92
 
92
- The full convention (frontmatter schema, body sections, self-review loop, open-questions, age tokens) lives in `docs/plans/AGENTS.md`. `docs/plans/CLAUDE.md` is a one-line `@AGENTS.md` import for Claude Code's nested discovery.
93
+ The full convention (frontmatter schema, body sections, one-pass local self-review, bounded strong-default X/S review receipts, workflow roles, open-questions, age tokens) lives in `docs/plans/AGENTS.md`. `docs/plans/CLAUDE.md` is a one-line `@AGENTS.md` import for Claude Code's nested discovery. If `.codex/agents/plan-manager.toml` and `.codex/agents/plan-review.toml` exist, Codex may use them for explicit subagent delegation; otherwise run the matching `plan-*` skill inline.
93
94
 
94
95
  Distinct from per-tool **Open Concerns** sections (wait-on-upstream
95
96
  blockers tied to a vendor shipping a fix — these live inside the per-tool
package/README.md CHANGED
@@ -39,7 +39,7 @@ RTK/Bun download boundaries, not as a global sync prerequisite.
39
39
  docks-kit sync [claude] [codex] [agents] deploy the SoT (default: all three)
40
40
  docks-kit update [--no-sync] self-update the kit (autodetects checkout vs global install), then sync
41
41
  docks-kit model <claude|codex> [value] get/set the DEPLOYED model (TTY picker)
42
- docks-kit models [tool] [--json] kit-verified model catalog
42
+ docks-kit models [claude|codex|workflow] model and workflow-role catalogs (`--json`)
43
43
  docks-kit toolchain [check|ensure <tool>] verified-version floors for external tools
44
44
  docks-kit status [--json] deployed-vs-SoT drift + toolchain + counts
45
45
  docks-kit plugins list [--json] enabledPlugins tri-state vs installed
@@ -71,6 +71,21 @@ golden-regression coverage for dry-run output, mutation snapshots, and argv logs
71
71
  and a later flag-less sync reverts them. Full reference: `docks-kit docs flags`
72
72
  (includes the old→new rename table for the pre-CLI `sync.sh` flags).
73
73
 
74
+ ### Docks workflow roles (root flags)
75
+
76
+ | Flag | Effect |
77
+ |------|--------|
78
+ | `--model-orchestrator=<selector>` | Override the Docks orchestrator candidate/profile |
79
+ | `--model-reviewer=<selector>` | Override the Docks reviewer candidate/profile |
80
+ | `--model-implementer=<selector>` | Override the Docks implementer candidate/profile |
81
+ | `--review-min-score=<0..100>` | Override the completion-review target |
82
+ | `--review-max-rounds=<1..10>` | Bound completion-review batches |
83
+
84
+ Selectors are strict `profile:<name>` or `<tool>:<model>@<effort>` values from
85
+ `docks-kit models workflow`. These root flags update only the identical compact
86
+ record in `~/.claude/CLAUDE.md` and `~/.codex/AGENTS.md`; omitted fields retain
87
+ their current valid values, while a later flag-less sync restores all defaults.
88
+
74
89
  ## How syncing works
75
90
 
76
91
  - **Additive by default** — user-only settings keys, plugins, and skills
@@ -83,7 +98,7 @@ and a later flag-less sync reverts them. Full reference: `docks-kit docs flags`
83
98
  (`--yes` accepts; non-TTY falls back to the pinned verified version
84
99
  when possible). `docks-kit toolchain check` shows the full table.
85
100
  - **Model catalog** — `SoT/models.json` is the research-verified source for
86
- model validation, listings, and pickers.
101
+ model validation, listings, pickers, and the Docks workflow-role registry.
87
102
  - **Claude runtime** — sync materializes three dependency-free Bun `.mjs`
88
103
  programs for statusline, SessionStart, and Notification. Quota display uses
89
104
  Claude's native `rate_limits`; there is no OAuth fetch, shared usage cache,
@@ -97,7 +112,7 @@ and a later flag-less sync reverts them. Full reference: `docks-kit docs flags`
97
112
  | `SoT/.claude/` | Claude Code SoT (settings template, Bun runtime programs, CLAUDE.md) |
98
113
  | `SoT/.codex/` | Codex SoT (config.toml, rules, AGENTS.md, marketplace) |
99
114
  | `SoT/.agents/` | Universal-skill manifest |
100
- | `SoT/models.json` | Kit-verified model catalog |
115
+ | `SoT/models.json` | Kit-verified model and Docks workflow-role catalog |
101
116
  | `SoT/toolchain.json` | Verified-version floors |
102
117
  | `cli/src/engine-native/` | EngineNative sync/model/toolchain implementation |
103
118
  | `cli/src/generated/sotPayload.ts` | Generated in-memory payload used by standalone and npm installs |
package/cli/docs/flags.md CHANGED
@@ -39,6 +39,23 @@ Bare model, effort, or advisor modifiers print the relevant valid-value catalog
39
39
  and exit 2. A modifier for a target not selected by the positional arguments is
40
40
  ignored with a warning; Claude modifiers never touch Codex config and vice versa.
41
41
 
42
+ ## Docks workflow root flags
43
+
44
+ These flags belong at the root (`docks-kit --model-reviewer=...`), not after
45
+ `sync`. They update only the shared deployed workflow record.
46
+
47
+ | Flag | Accepted value |
48
+ |------|----------------|
49
+ | `--model-orchestrator=<selector>` | `profile:<name>` or `<tool>:<model>@<effort>` |
50
+ | `--model-reviewer=<selector>` | same strict selector grammar |
51
+ | `--model-implementer=<selector>` | same strict selector grammar |
52
+ | `--review-min-score=<n>` | base-10 integer `0..100` |
53
+ | `--review-max-rounds=<n>` | base-10 integer `1..10` |
54
+
55
+ Use `docks-kit models workflow [--json]` for the closed registry. Bare, empty,
56
+ unknown, or malformed values print that helper and exit 2 before either prompt
57
+ file changes.
58
+
42
59
  ## Renamed legacy flags (pre-CLI sync.sh)
43
60
 
44
61
  Old flags exit with a rename hint — there is no compat behavior.
@@ -31,8 +31,27 @@ docks-kit models claude --json # machine-readable
31
31
  docks-kit model claude # current deployed + SoT + picker (TTY)
32
32
  docks-kit model claude opus # per-machine override from the Fable SoT
33
33
  docks-kit sync claude --claude-model=opus # same, as part of a sync
34
+ docks-kit models workflow # Docks workflow profiles and defaults
35
+ docks-kit models workflow --json # closed machine-readable registry
34
36
  ```
35
37
 
38
+ ## Docks workflow-role registry
39
+
40
+ The `workflow` section is strict even though ordinary tool-model modifiers are
41
+ forward-compatible. It accepts only known `profile:<name>` values or exact
42
+ `<tool>:<model>@<effort>` targets whose model and effort both appear in the
43
+ catalog. The defaults are:
44
+
45
+ - orchestrator: `profile:claude-best`, ordered as `claude:fable@high` then
46
+ `claude:opus@xhigh`;
47
+ - reviewer and implementer: `codex:gpt-5.6-sol@xhigh`;
48
+ - review minimum score 90 and maximum 3 rounds.
49
+
50
+ `claude:best@high` is Claude's native one-model alias. It is deliberately not
51
+ the same as the Docks-managed `profile:claude-best` candidate chain.
52
+ Availability is `checked_when_used`: Docks classifies each launch attempt;
53
+ docks-kit neither probes providers nor promises provider-wide fallback.
54
+
36
55
  ## Advisor pairing note (Claude)
37
56
 
38
57
  The SoT ships `model: fable` with advisor off (`advisorModel` unset).
@@ -44,6 +44,29 @@ docks-kit model codex gpt-5.5 # codex flavor
44
44
  The set path calls the same engine functions as the sync flags —
45
45
  one implementation, two entry points.
46
46
 
47
+ ## Workflow-role overrides (root, no full sync)
48
+
49
+ The root workflow flags are deployed modifiers for Docks rather than one tool:
50
+
51
+ ```text
52
+ docks-kit --model-orchestrator=profile:claude-best \
53
+ --model-reviewer=codex:gpt-5.6-terra@high \
54
+ --review-min-score=80 --review-max-rounds=5
55
+ ```
56
+
57
+ They atomically write one byte-identical complete record to
58
+ `~/.claude/CLAUDE.md` and `~/.codex/AGENTS.md`. Omitted fields retain the
59
+ current valid record; a missing side is repaired. Invalid or conflicting state
60
+ stops before mutation, a repeated request is a no-op, and failure on the second
61
+ atomic write restores both snapshots. A later flag-less sync restores the
62
+ embedded defaults. Start fresh sessions after changing the record.
63
+
64
+ Selectors are strict `profile:<name>` or `<tool>:<model>@<effort>` entries from
65
+ `docks-kit models workflow`. `profile:claude-best` is the ordered Docks
66
+ Fable-high then Opus-xhigh chain; `claude:best@high` is instead Claude's native
67
+ single-model alias. Docks checks each candidate when used—there is no docks-kit
68
+ provider preflight.
69
+
47
70
  ## Sticky opt-ins are NOT modifiers
48
71
 
49
72
  `--claude-plugin=<name>` installs+enables an optional plugin and it STAYS
@@ -2,9 +2,10 @@ import { Args, Command, Options } from "@effect/cli"
2
2
  import { Console, Effect, Option } from "effect"
3
3
  import { bail } from "../engine"
4
4
  import { modelCatalog, type Tool } from "../manifests"
5
+ import { workflowCatalog, workflowRegistryJson } from "../workflowModels"
5
6
 
6
7
  const tool = Args.text({ name: "tool" }).pipe(
7
- Args.withDescription("claude | codex (omit for both)"),
8
+ Args.withDescription("claude | codex | workflow (omit for both tool catalogs)"),
8
9
  Args.optional
9
10
  )
10
11
  const json = Options.boolean("json").pipe(
@@ -24,8 +25,11 @@ const renderTool = (t: Tool) =>
24
25
  export const modelsCommand = Command.make("models", { tool, json }, (config) =>
25
26
  Effect.gen(function* () {
26
27
  const requested = Option.getOrUndefined(config.tool)
28
+ if (requested === "workflow") {
29
+ return yield* Console.log(config.json ? workflowRegistryJson() : workflowCatalog())
30
+ }
27
31
  if (requested !== undefined && requested !== "claude" && requested !== "codex") {
28
- return yield* bail(`Unknown tool '${requested}' (valid: claude, codex)`)
32
+ return yield* bail(`Unknown tool '${requested}' (valid: claude, codex, workflow)`)
29
33
  }
30
34
  const tools: Array<Tool> = requested !== undefined ? [requested as Tool] : ["claude", "codex"]
31
35
 
@@ -42,5 +46,5 @@ export const modelsCommand = Command.make("models", { tool, json }, (config) =>
42
46
  )
43
47
  })
44
48
  ).pipe(
45
- Command.withDescription("List the kit-verified model catalog (SoT/models.json) for claude/codex.")
49
+ Command.withDescription("List kit-verified tool models or the Docks workflow role registry (SoT/models.json).")
46
50
  )
@@ -31,6 +31,7 @@ import { ExitError } from "./parseArgs"
31
31
  import { mergeSettings, reconcileSettings } from "./settings"
32
32
  import { ensure, field } from "./toolchain"
33
33
  import { payloadBytes, payloadDisplayPath, payloadText } from "../payload"
34
+ import { renderDefaultWorkflowInstructions } from "./workflowDeploy"
34
35
 
35
36
  export type ClaudeRuntimeState =
36
37
  | { readonly kind: "ready"; readonly paths: ClaudeRuntimePaths }
@@ -222,7 +223,7 @@ function syncClaudeMd(ctx: Ctx, claudeDir: string): void {
222
223
  return
223
224
  }
224
225
 
225
- const source = payloadText("SoT/.claude/CLAUDE.md")
226
+ const source = renderDefaultWorkflowInstructions(payloadText("SoT/.claude/CLAUDE.md"))
226
227
  const stripReason = ctx.skipRtk ? "--skip-rtk" : rtkMdAbsent ? "~/.claude/RTK.md absent (rtk not initialized)" : ""
227
228
  if (stripReason !== "") {
228
229
  const stripped = source
@@ -12,6 +12,7 @@ import type { Ctx } from "./index"
12
12
  import { compareCodepoints, isObject, jqStringify, parseJson, type Json } from "./jq"
13
13
  import { sessionRelayReadiness } from "./sessionRelayReadiness"
14
14
  import { payloadBytes, payloadDisplayPath, payloadPaths, payloadText, type PayloadPath } from "../payload"
15
+ import { renderDefaultWorkflowInstructions } from "./workflowDeploy"
15
16
 
16
17
  export function codexSync(ctx: Ctx): void {
17
18
  const codexDir = p(ctx.home, ".codex")
@@ -24,7 +25,7 @@ export function codexSync(ctx: Ctx): void {
24
25
  syncCodexModel(ctx, ctx.codexModel)
25
26
  syncCodexEffort(ctx, ctx.codexEffort)
26
27
  syncRules(ctx, payloadPaths("SoT/.codex/rules/"), p(codexDir, "rules"))
27
- syncAgentsMd(ctx, payloadText("SoT/.codex/AGENTS.md"), p(codexDir, "AGENTS.md"))
28
+ syncAgentsMd(ctx, renderDefaultWorkflowInstructions(payloadText("SoT/.codex/AGENTS.md")), p(codexDir, "AGENTS.md"))
28
29
  syncMarketplace(ctx, payloadText("SoT/.codex/plugins/marketplace.json"), p(ctx.agentsDir, "plugins", "marketplace.json"))
29
30
  removeLegacyDocksMarketplace(ctx, userConfig)
30
31
  syncPlugins(ctx, sotConfig)
@@ -15,7 +15,8 @@ import { claudeNextSteps, claudeSummary, claudeSync } from "./claudeSync"
15
15
  import { codexNextSteps, codexSummary, codexSync } from "./codexSync"
16
16
  import { skillsNextSteps, skillsSummary, skillsSync } from "./skillsSync"
17
17
  import { modeModel, modeToolchain } from "./modes"
18
- import { ExitError, parseArgs, validateModifierFlags } from "./parseArgs"
18
+ import { ExitError, parseArgs, parseWorkflowArgs, printWorkflowUsage, validateModifierFlags } from "./parseArgs"
19
+ import { deployWorkflowOverrides } from "./workflowDeploy"
19
20
 
20
21
  export type ModifierFlag =
21
22
  | "--claude-model"
@@ -124,6 +125,19 @@ function engineSync(ctx: Ctx, args: ReadonlyArray<string>): number {
124
125
  return 0
125
126
  }
126
127
 
128
+ function engineWorkflow(ctx: Ctx, args: ReadonlyArray<string>): number {
129
+ try {
130
+ const overrides = parseWorkflowArgs(ctx, args)
131
+ deployWorkflowOverrides(ctx, overrides)
132
+ return 0
133
+ } catch (error) {
134
+ if (error instanceof ExitError) throw error
135
+ printWorkflowUsage(ctx)
136
+ ctx.services.logger.err(error instanceof Error ? error.message : String(error))
137
+ throw new ExitError(2)
138
+ }
139
+ }
140
+
127
141
  export function runEngineNative(argv: ReadonlyArray<string>, services?: EngineServices): number {
128
142
  let ctx!: Ctx
129
143
  const baseServices = services ?? makeEngineServices()
@@ -149,6 +163,8 @@ export function runEngineNative(argv: ReadonlyArray<string>, services?: EngineSe
149
163
  return modeModel(ctx, argv.slice(1))
150
164
  case "toolchain":
151
165
  return modeToolchain(ctx, argv.slice(1))
166
+ case "workflow":
167
+ return engineWorkflow(ctx, argv.slice(1))
152
168
  case "sync":
153
169
  return engineSync(ctx, argv.slice(1))
154
170
  default:
@@ -16,6 +16,11 @@ import {
16
16
  isEffortModifierValue
17
17
  } from "../efforts"
18
18
  import { printModels, validateClaudeModel, validateCodexModel } from "./models"
19
+ import {
20
+ buildWorkflowRecord,
21
+ workflowCatalog,
22
+ type WorkflowOverrides
23
+ } from "../workflowModels"
19
24
 
20
25
  export class ExitError extends Error {
21
26
  constructor(readonly code: number) {
@@ -259,6 +264,65 @@ function printCatalog(ctx: Ctx, catalog: string): void {
259
264
  for (const line of catalog.split("\n")) ctx.services.logger.echo(line)
260
265
  }
261
266
 
267
+ const WORKFLOW_FLAGS = {
268
+ "--model-orchestrator": "orchestrator",
269
+ "--model-reviewer": "reviewer",
270
+ "--model-implementer": "implementer",
271
+ "--review-min-score": "minimumScore",
272
+ "--review-max-rounds": "maxRounds"
273
+ } as const satisfies Readonly<Record<string, keyof WorkflowOverrides>>
274
+
275
+ function workflowUsage(ctx: Ctx): void {
276
+ printCatalog(ctx, workflowCatalog())
277
+ ctx.services.logger.echo("")
278
+ ctx.services.logger.echo("Workflow override flags:")
279
+ ctx.services.logger.echo(" --model-orchestrator=<profile:name|tool:model@effort>")
280
+ ctx.services.logger.echo(" --model-reviewer=<profile:name|tool:model@effort>")
281
+ ctx.services.logger.echo(" --model-implementer=<profile:name|tool:model@effort>")
282
+ ctx.services.logger.echo(" --review-min-score=<0..100>")
283
+ ctx.services.logger.echo(" --review-max-rounds=<1..10>")
284
+ }
285
+
286
+ export function parseWorkflowArgs(ctx: Ctx, args: ReadonlyArray<string>): WorkflowOverrides {
287
+ const overrides: Partial<Record<keyof WorkflowOverrides, string>> = {}
288
+ for (let index = 0; index < args.length; index += 1) {
289
+ const arg = args[index] ?? ""
290
+ if (arg === "-h" || arg === "--help") {
291
+ workflowUsage(ctx)
292
+ throw new ExitError(0)
293
+ }
294
+
295
+ const equals = arg.indexOf("=")
296
+ const flag = equals === -1 ? arg : arg.slice(0, equals)
297
+ const key = WORKFLOW_FLAGS[flag as keyof typeof WORKFLOW_FLAGS]
298
+ if (key === undefined) throw new Error(`Unknown workflow arg: ${arg}`)
299
+
300
+ let value: string
301
+ if (equals !== -1) {
302
+ value = arg.slice(equals + 1)
303
+ } else {
304
+ const next = args[index + 1]
305
+ if (next === undefined || next.startsWith("--")) {
306
+ throw new Error(`${flag} requires a value: ${flag}=<value>`)
307
+ }
308
+ value = next
309
+ index += 1
310
+ }
311
+ if (value === "") throw new Error(`${flag} requires a value: ${flag}=<value>`)
312
+ overrides[key] = value
313
+ }
314
+
315
+ if (Object.keys(overrides).length === 0) {
316
+ throw new Error("At least one workflow override flag is required")
317
+ }
318
+ buildWorkflowRecord(overrides)
319
+ return overrides
320
+ }
321
+
322
+ export function printWorkflowUsage(ctx: Ctx): void {
323
+ workflowUsage(ctx)
324
+ }
325
+
262
326
  export function validateModifierFlags(ctx: Ctx): void {
263
327
  const { err, warn } = ctx.services.logger
264
328
  const supplied = (flag: ModifierFlag, value: string): boolean =>
@@ -0,0 +1,139 @@
1
+ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs"
2
+ import { dirname } from "node:path"
3
+
4
+ import type { Ctx } from "./index"
5
+ import {
6
+ WORKFLOW_RECORD_PREFIX,
7
+ buildWorkflowRecord,
8
+ defaultWorkflowRecord,
9
+ parseWorkflowRecord,
10
+ renderWorkflowRecordLine,
11
+ type WorkflowOverrides,
12
+ type WorkflowRecordV1
13
+ } from "../workflowModels"
14
+
15
+ export interface WorkflowFileSystem {
16
+ readonly read: (path: string) => string | undefined
17
+ readonly writeAtomic: (path: string, bytes: string) => void
18
+ readonly remove: (path: string) => void
19
+ }
20
+
21
+ let atomicWriteSequence = 0
22
+
23
+ const nodeFileSystem: WorkflowFileSystem = {
24
+ read: (path) => existsSync(path) ? readFileSync(path, "utf8") : undefined,
25
+ writeAtomic: (path, bytes) => {
26
+ mkdirSync(dirname(path), { recursive: true })
27
+ const temporary = `${path}.tmp-${process.pid}-${atomicWriteSequence++}`
28
+ try {
29
+ writeFileSync(temporary, bytes)
30
+ renameSync(temporary, path)
31
+ } finally {
32
+ rmSync(temporary, { force: true })
33
+ }
34
+ },
35
+ remove: (path) => rmSync(path, { force: true })
36
+ }
37
+
38
+ interface DocumentRecord {
39
+ readonly record: WorkflowRecordV1 | undefined
40
+ readonly line: string | undefined
41
+ }
42
+
43
+ function readDocumentRecord(document: string | undefined, label: string): DocumentRecord {
44
+ const lines = (document ?? "").split("\n").filter((line) => line.startsWith(WORKFLOW_RECORD_PREFIX))
45
+ if (lines.length === 0) return { record: undefined, line: undefined }
46
+
47
+ let canonicalLine: string | undefined
48
+ let canonicalRecord: WorkflowRecordV1 | undefined
49
+ for (const line of lines) {
50
+ let record: WorkflowRecordV1
51
+ try {
52
+ record = parseWorkflowRecord(JSON.parse(line.slice(WORKFLOW_RECORD_PREFIX.length)) as unknown)
53
+ } catch (error) {
54
+ const detail = error instanceof Error ? error.message : String(error)
55
+ throw new Error(`${label} contains a malformed Docks workflow record: ${detail}`)
56
+ }
57
+ const rendered = renderWorkflowRecordLine(record)
58
+ if (canonicalLine !== undefined && rendered !== canonicalLine) {
59
+ throw new Error(`${label} contains conflicting Docks workflow records`)
60
+ }
61
+ canonicalLine = rendered
62
+ canonicalRecord = record
63
+ }
64
+ return { record: canonicalRecord, line: canonicalLine }
65
+ }
66
+
67
+ export function upsertWorkflowRecord(document: string, record: WorkflowRecordV1): string {
68
+ const content = document
69
+ .split("\n")
70
+ .filter((line) => !line.startsWith(WORKFLOW_RECORD_PREFIX))
71
+ .join("\n")
72
+ .replace(/\n+$/, "")
73
+ const line = renderWorkflowRecordLine(record)
74
+ return content === "" ? `${line}\n` : `${content}\n${line}\n`
75
+ }
76
+
77
+ export function renderDefaultWorkflowInstructions(document: string): string {
78
+ readDocumentRecord(document, "SoT instruction document")
79
+ return upsertWorkflowRecord(document, defaultWorkflowRecord())
80
+ }
81
+
82
+ function restoreSnapshot(fileSystem: WorkflowFileSystem, path: string, snapshot: string | undefined): void {
83
+ if (snapshot === undefined) fileSystem.remove(path)
84
+ else fileSystem.writeAtomic(path, snapshot)
85
+ }
86
+
87
+ export function deployWorkflowOverrides(
88
+ ctx: Ctx,
89
+ overrides: WorkflowOverrides,
90
+ fileSystem: WorkflowFileSystem = nodeFileSystem
91
+ ): void {
92
+ const claudePath = `${ctx.home}/.claude/CLAUDE.md`
93
+ const codexPath = `${ctx.home}/.codex/AGENTS.md`
94
+ const claudeBefore = fileSystem.read(claudePath)
95
+ const codexBefore = fileSystem.read(codexPath)
96
+ const claudeState = readDocumentRecord(claudeBefore, claudePath)
97
+ const codexState = readDocumentRecord(codexBefore, codexPath)
98
+
99
+ if (claudeState.line !== undefined && codexState.line !== undefined && claudeState.line !== codexState.line) {
100
+ throw new Error("Claude and Codex instruction files contain conflicting Docks workflow records")
101
+ }
102
+
103
+ const base = claudeState.record ?? codexState.record ?? defaultWorkflowRecord()
104
+ const record = buildWorkflowRecord(overrides, base)
105
+ const claudeAfter = upsertWorkflowRecord(claudeBefore ?? "", record)
106
+ const codexAfter = upsertWorkflowRecord(codexBefore ?? "", record)
107
+ const claudeChanged = claudeBefore !== claudeAfter
108
+ const codexChanged = codexBefore !== codexAfter
109
+
110
+ if (ctx.dryRun) {
111
+ if (claudeChanged) ctx.services.logger.echo(`[dry-run] update Docks workflow record in ${claudePath}`)
112
+ if (codexChanged) ctx.services.logger.echo(`[dry-run] update Docks workflow record in ${codexPath}`)
113
+ if (!claudeChanged && !codexChanged) ctx.services.logger.verbose("Workflow models already match the requested state")
114
+ return
115
+ }
116
+
117
+ if (!claudeChanged && !codexChanged) {
118
+ ctx.services.logger.verbose("Workflow models already match the requested state")
119
+ return
120
+ }
121
+
122
+ try {
123
+ if (claudeChanged) fileSystem.writeAtomic(claudePath, claudeAfter)
124
+ if (codexChanged) fileSystem.writeAtomic(codexPath, codexAfter)
125
+ } catch (error) {
126
+ try {
127
+ restoreSnapshot(fileSystem, claudePath, claudeBefore)
128
+ restoreSnapshot(fileSystem, codexPath, codexBefore)
129
+ } finally {
130
+ ctx.services.logger.err("Workflow update failed; restored both instruction files to their pre-run state")
131
+ }
132
+ throw error
133
+ }
134
+
135
+ ctx.services.logger.change("Workflow models updated in Claude and Codex instructions")
136
+ ctx.services.logger.warn("Start fresh Claude Code and Codex sessions before relying on the new workflow roles")
137
+ ctx.nextStepTriggers.claudeRestart = true
138
+ ctx.nextStepTriggers.codexRestart = true
139
+ }
@@ -1,19 +1,19 @@
1
1
  // Generated by cli/scripts/generate-sot-payload.ts. DO NOT EDIT.
2
2
  // Edit SoT/, notification.mp3, or package.json, then run: bun cli/scripts/generate-sot-payload.ts
3
3
 
4
- export const GENERATED_PACKAGE_VERSION = "0.6.0"
4
+ export const GENERATED_PACKAGE_VERSION = "0.7.0"
5
5
 
6
6
  export const GENERATED_PAYLOAD_TEXT = {
7
7
  "SoT/.agents/skills.txt": "# Universal AI-agent skills (agentskills.io standard).\n# Bootstrapped to ~/.agents/skills/ by cli/src/engine-native/skillsSync.ts during ./docks-kit sync.\n# One slug per line: <owner>/<repo>. Lines starting with # are comments.\n# Each skill's canonical SKILL.md lands in ~/.agents/skills/<name>/ — Codex\n# reads that path natively; Claude Code gets a ~/.claude/skills/<name>\n# symlink to it. The skills sync names both agents the kit supports\n# (-a claude-code codex) so the CLI keeps the shared canonical copy.\n\n# Browser automation CLI — reaches JS-rendered, auth-walled, login-gated pages\n# (x.com, LinkedIn, Confluence) that built-in WebFetch can't. The skills sync\n# auto-installs the `agent-browser` npm package + downloads Chrome for Testing\n# (~175 MB) on first sync; Linux runs `agent-browser install --with-deps` which\n# may prompt for sudo to install system libs (libnss3, libatk, ...).\nvercel-labs/agent-browser\n",
8
- "SoT/models.json": "{\n \"$comment\": \"Kit-verified model catalog — single source for EngineNative validators, the docks-kit CLI (models/model commands, pickers, bare-flag help), and docs. Entries are research-proofed: update an entry and its tool-level `verified` date when a model ships or retires. The catalog informs, it doesn't imprison: well-formed IDs outside it (claude-* / codex charset) apply with a warning.\",\n \"claude\": {\n \"verified\": \"2026-07-08\",\n \"models\": [\n { \"id\": \"best\", \"kind\": \"alias\", \"note\": \"Fable 5 where the org has access, latest Opus otherwise (Claude Code >=2.1.170)\" },\n { \"id\": \"opus\", \"kind\": \"alias\", \"note\": \"latest Opus (currently Opus 4.8)\" },\n { \"id\": \"fable\", \"kind\": \"alias\", \"note\": \"Fable 5 — the kit SoT default; needs org access + Claude Code >=2.1.170\" },\n { \"id\": \"sonnet\", \"kind\": \"alias\", \"note\": \"latest Sonnet (currently Sonnet 5)\" },\n { \"id\": \"haiku\", \"kind\": \"alias\", \"note\": \"latest Haiku (currently Haiku 4.5)\" },\n { \"id\": \"default\", \"kind\": \"alias\", \"note\": \"engine pseudo-value: deletes the deployed model key so the account default applies\" },\n { \"id\": \"claude-fable-5\", \"kind\": \"id\", \"note\": \"Fable 5\" },\n { \"id\": \"claude-opus-4-8\", \"kind\": \"id\", \"note\": \"Opus 4.8\" },\n { \"id\": \"claude-sonnet-5\", \"kind\": \"id\", \"note\": \"Sonnet 5\" },\n { \"id\": \"claude-haiku-4-5-20251001\", \"kind\": \"id\", \"note\": \"Haiku 4.5\" }\n ]\n },\n \"codex\": {\n \"verified\": \"2026-07-09\",\n \"models\": [\n { \"id\": \"gpt-5.6-sol\", \"kind\": \"id\", \"note\": \"GPT-5.6 Sol — frontier, recommended default; the kit SoT pin\" },\n { \"id\": \"gpt-5.6-terra\", \"kind\": \"id\", \"note\": \"GPT-5.6 Terra — balanced tier\" },\n { \"id\": \"gpt-5.6-luna\", \"kind\": \"id\", \"note\": \"GPT-5.6 Luna — fast/light tier\" },\n { \"id\": \"gpt-5.5\", \"kind\": \"id\", \"note\": \"previous generation\" },\n { \"id\": \"gpt-5.5-codex\", \"kind\": \"id\", \"note\": \"codex-tuned gpt-5.5\" },\n { \"id\": \"gpt-5.1\", \"kind\": \"id\", \"note\": \"previous generation\" },\n { \"id\": \"gpt-5\", \"kind\": \"id\", \"note\": \"previous generation\" },\n { \"id\": \"gpt-5-codex\", \"kind\": \"id\", \"note\": \"codex-tuned gpt-5\" }\n ]\n }\n}\n",
8
+ "SoT/models.json": "{\n \"$comment\": \"Kit-verified model catalog — single source for EngineNative validators, the docks-kit CLI (models/model commands, workflow selectors, pickers, bare-flag help), and docs. Entries are research-proofed: update an entry and its tool-level `verified` date when a model ships or retires. Deploy-time model flags remain permissive; workflow selectors are strict.\",\n \"claude\": {\n \"verified\": \"2026-07-08\",\n \"models\": [\n { \"id\": \"best\", \"kind\": \"alias\", \"note\": \"Fable 5 where the org has access, latest Opus otherwise (Claude Code >=2.1.170)\" },\n { \"id\": \"opus\", \"kind\": \"alias\", \"note\": \"latest Opus (currently Opus 4.8)\" },\n { \"id\": \"fable\", \"kind\": \"alias\", \"note\": \"Fable 5 — the kit SoT default; needs org access + Claude Code >=2.1.170\" },\n { \"id\": \"sonnet\", \"kind\": \"alias\", \"note\": \"latest Sonnet (currently Sonnet 5)\" },\n { \"id\": \"haiku\", \"kind\": \"alias\", \"note\": \"latest Haiku (currently Haiku 4.5)\" },\n { \"id\": \"default\", \"kind\": \"alias\", \"note\": \"engine pseudo-value: deletes the deployed model key so the account default applies\" },\n { \"id\": \"claude-fable-5\", \"kind\": \"id\", \"note\": \"Fable 5\" },\n { \"id\": \"claude-opus-4-8\", \"kind\": \"id\", \"note\": \"Opus 4.8\" },\n { \"id\": \"claude-sonnet-5\", \"kind\": \"id\", \"note\": \"Sonnet 5\" },\n { \"id\": \"claude-haiku-4-5-20251001\", \"kind\": \"id\", \"note\": \"Haiku 4.5\" }\n ]\n },\n \"codex\": {\n \"verified\": \"2026-07-09\",\n \"models\": [\n { \"id\": \"gpt-5.6-sol\", \"kind\": \"id\", \"note\": \"GPT-5.6 Sol — frontier, recommended default; the kit SoT pin\" },\n { \"id\": \"gpt-5.6-terra\", \"kind\": \"id\", \"note\": \"GPT-5.6 Terra — balanced tier\" },\n { \"id\": \"gpt-5.6-luna\", \"kind\": \"id\", \"note\": \"GPT-5.6 Luna — fast/light tier\" },\n { \"id\": \"gpt-5.5\", \"kind\": \"id\", \"note\": \"previous generation\" },\n { \"id\": \"gpt-5.5-codex\", \"kind\": \"id\", \"note\": \"codex-tuned gpt-5.5\" },\n { \"id\": \"gpt-5.1\", \"kind\": \"id\", \"note\": \"previous generation\" },\n { \"id\": \"gpt-5\", \"kind\": \"id\", \"note\": \"previous generation\" },\n { \"id\": \"gpt-5-codex\", \"kind\": \"id\", \"note\": \"codex-tuned gpt-5\" }\n ]\n },\n \"workflow\": {\n \"schema\": 1,\n \"profiles\": {\n \"claude-best\": {\n \"candidates\": [\n { \"company\": \"anthropic\", \"tool\": \"claude\", \"model\": \"fable\", \"effort\": \"high\" },\n { \"company\": \"anthropic\", \"tool\": \"claude\", \"model\": \"opus\", \"effort\": \"xhigh\" }\n ]\n }\n },\n \"defaults\": {\n \"orchestrator\": \"profile:claude-best\",\n \"reviewer\": \"codex:gpt-5.6-sol@xhigh\",\n \"implementer\": \"codex:gpt-5.6-sol@xhigh\",\n \"review\": {\n \"minimum_score\": 90,\n \"max_rounds\": 3\n }\n },\n \"exact_target_grammar\": \"<tool>:<model>@<effort>\",\n \"availability\": \"checked_when_used\"\n }\n}\n",
9
9
  "SoT/toolchain.json": "{\n \"$comment\": \"Kit toolchain manifest — DATA only (versions, floors, policy); check/install logic lives in cli/src/engine-native/toolchain.ts with per-surface sync callbacks in cli/src/engine-native/. kind: check (doctor visibility only) | managed (kit installs/upgrades it) | pin (no binary probe — a version pin for a tool the kit invokes via npx). policy (managed only): track (upgrade toward latest, gated by `verified`) | present (install when missing, never upgrade). `verified` = last kit-tested version — anything above it prompts before install (--yes auto-accepts; non-TTY declines and falls back to the pinned `verified` when pinnable). Supply-chain stance: every kit-driven install is pinned to `verified` or gated by it — never floating @latest (npm-worm/Shai-Hulud surface). Update `verified` after testing a new release.\",\n \"tools\": {\n \"jq\": { \"kind\": \"check\", \"note\": \"optional operator CLI; EngineNative JSON and Claude runtime do not invoke it\" },\n \"curl\": { \"kind\": \"check\", \"note\": \"contextual POSIX installer transport for RTK/Bun bootstrap\" },\n \"git\": { \"kind\": \"check\", \"note\": \"plugin marketplaces (claude/codex clone them) + kit checkout updates\" },\n \"node\": { \"kind\": \"check\", \"note\": \"hosts npm globals (agent-browser, LSP servers)\" },\n \"npm\": { \"kind\": \"check\", \"note\": \"npm-global installer\" },\n \"claude\": { \"kind\": \"check\", \"floor\": \"2.1.170\", \"note\": \"kit floor — `best` alias + Fable 5 need >=2.1.170 (mirrors settings minimumVersion)\" },\n \"codex\": { \"kind\": \"check\", \"note\": \"upstream-owned; standalone installer prints when missing\" },\n \"ffplay\": { \"kind\": \"check\", \"note\": \"Notification hook sound (previously unchecked)\" },\n \"bwrap\": { \"kind\": \"check\", \"os\": \"linux\", \"note\": \"Codex Linux sandbox runtime\" },\n \"intelephense\": { \"kind\": \"check\", \"verified\": \"1.18.5\", \"note\": \"php-lsp server binary; `verified` pins claude::sync_lsp_servers' npm install\" },\n \"typescript-language-server\": { \"kind\": \"check\", \"verified\": \"5.3.0\", \"note\": \"typescript-lsp server binary; `verified` pins claude::sync_lsp_servers' npm install\" },\n \"tsc\": { \"kind\": \"check\", \"verified\": \"6.0.3\", \"note\": \"typescript-lsp dependency (npm package `typescript`); `verified` pins claude::sync_lsp_servers' npm install. Deliberately on the 6.x line: typescript-language-server embeds TypeScript's programmatic API, which TS7 (native) doesn't yet expose — the repo's own devDependency runs TS7 for tsc --noEmit\" },\n \"rtk\": { \"kind\": \"managed\", \"policy\": \"track\", \"floor\": \"0.43.0\", \"verified\": \"0.43.0\", \"pinnable\": true,\n \"note\": \"PreToolUse hook — supply-chain review before unverified upgrades; installer honors RTK_VERSION=vX.Y.Z pin\" },\n \"bun\": { \"kind\": \"managed\", \"policy\": \"present\", \"verified\": \"1.3.14\", \"pinnable\": true,\n \"note\": \"runtime for effect-solutions + the docks-kit CLI; bootstrap installs the verified release (installer takes bun-vX.Y.Z); self-updates via `bun upgrade` when wanted\" },\n \"effect-solutions\": { \"kind\": \"managed\", \"policy\": \"track\", \"verified\": \"0.5.3\", \"pinnable\": true,\n \"note\": \"Effect docs CLI (bun global) — track keeps it self-upgrading, gated by the verified pin\" },\n \"agent-browser\": { \"kind\": \"managed\", \"policy\": \"track\", \"verified\": \"0.31.1\", \"pinnable\": true,\n \"note\": \"browser-automation CLI (npm global), gated by the verified pin; first install also downloads Chrome for Testing\" },\n \"skills-cli\": { \"kind\": \"pin\", \"verified\": \"1.5.15\",\n \"note\": \"the `skills` npm package the kit runs via `npx skills@<verified>` on every agents sync (universal-skill install/remove) — pinned, never @latest\" }\n }\n}\n",
10
- "SoT/.claude/CLAUDE.md": "@RTK.md\n\n## Research Before Implementation\n\nBefore writing or modifying code that uses an API, hook, method, or config surface you have not verified in this session, research current documentation first.\n\n**Research workflow:**\n1. Use `resolve-library-id` → `query-docs` (context7) to fetch up-to-date docs for the specific library/framework\n2. If context7 doesn't cover it, read the official docs with `agent-browser` (it reaches JS-rendered, auth-walled, and login-gated pages); fall back to `WebFetch` for a simple static page\n3. Only then proceed to implementation\n\n**When to research:**\n- Installing or configuring a dependency\n- Using an API, hook, method, or pattern you haven't verified in this session\n- Upgrading or migrating between versions\n- Any task where you'd otherwise rely on training data for syntax/behavior\n\n**Do NOT:**\n- Assume API signatures, method names, or config options from memory\n- Generate framework code without checking current docs first\n- Skip research because the library \"seems familiar\"\n\n<constraint>\nResearch the codebase before editing. Never change code you haven't read.\n</constraint>\n\n## Agentic Harness Heuristics\n\n**1. Persistence.** Keep going until the user's query is completely resolved. Only yield when sure the problem is solved. Before ending a turn, check the last paragraph: if it is a plan, a question you can answer yourself, or a promise of work not done (\"I'll…\"), do that work now.\n\n**2. Default to parallel.** Whenever you have multiple independent operations (reads, greps, web fetches, independent edits), invoke them in a single response with multiple tool-use blocks. Sequential calls only when output of one operation is required as input to the next.\n\n**3. Multi-pass search.** First-pass search often misses — vary the wording (colleague-questions over keywords) before concluding something doesn't exist.\n\n**4. Trace symbols.** Before modifying a symbol, trace it to its definitions and all usages. Don't assume a function's behavior or a type's shape from the call site alone.\n\n**5. Linter-loop 3-strike rule.** Don't loop more than 3 times fixing linter errors on the same file. On the third attempt, stop and ask the user — repeated failure usually means the diagnosis is wrong, not the code.\n\n**6. Read-before-Edit TTL.** If you haven't read a file with the Read tool in the last ~5 messages, re-read it before editing. Cached file content goes stale silently when the user edits between turns.\n\n**7. Big-file rule.** For files >1000 lines, prefer Grep + scoped Read (`offset` + `limit`) over reading the entire file. Whole-file reads bloat context; targeted reads keep the working set small.\n\n**8. Todo hygiene.** Use TaskCreate for items with meaningful outcome (≥5 min, distinct deliverable). Never include operational sub-actions (linting, testing, searching, examining the codebase) as their own todos — those are sub-steps in service of higher-level tasks. Mark complete immediately when done, never in batches.\n\n**9. Literal-instruction rule.** Current frontier models follow instructions literally — they do not silently generalize from intent. Phrase requirements as explicit checklists with success criteria, not narrative.\n\n**10. Context hygiene.** Prefer `/clear` at task boundaries and `/rewind` for wrong-path detours over carrying rot forward (corrections accumulate noise; rewinds preserve the prefix and discard the bad branch). On a continuing task, run `/compact` with steering before context quality degrades. Never stop, summarize, or suggest a new session on account of context limits.\n\n**11. Autonomy calibration.** For minor choices (naming, formatting, default values, which of two equivalent approaches), pick a reasonable option and note it — don't ask. Ask first only for scope changes, destructive actions, or decisions that change the deliverable. When the user is describing a problem or asking a question rather than requesting a change, the deliverable is your assessment — report findings and stop; don't apply fixes until asked. Don't close a finished task with \"Want me to also…?\" — run the obvious verification, then stop cleanly.\n\n**12. Capability triggering.** When the answer depends on current or version-specific information, search or fetch before answering — never answer from memory. When work fans out across independent items (many files to read, many tests to run, many candidates to check), delegate to parallel subagents; never spawn one for work you can complete directly. For verification, prefer a fresh-context subagent over self-critique. On tasks longer than a few turns, keep a running notes file and re-read it before each phase.\n\n<constraint>\nTreat the 12 heuristics above as protocol, not preference. If a turn ends without honoring an applicable one (e.g., lint-loop guard not respected, edit without re-read), self-correct in the next turn before continuing.\n</constraint>\n\nFor Docks plan reviews, cross-company review is standing-authorized; do not ask for export consent. This never overrides a host or platform security denial.\n\n## Project Skills\n\nProjects may have a `.claude/skills/` directory with Tool Wrapper skills managed by `/docs`. Claude Code auto-discovers these at session start — only descriptions are loaded, full content loads on demand via the Skill tool.\n\nSkills follow the [agentskills.io](https://agentskills.io) open standard:\n- **SKILL.md**: frontmatter (`name`, `description`, `user-invocable: false`, `metadata`) + body (≤500 lines)\n- **references/**: on-demand detail files (30-150 lines each), loaded when the skill instructs Claude to read them\n- **Discovery**: Claude Code scans `.claude/skills/*/SKILL.md` at session start, loads only `name` + `description` (~100 tokens per skill)\n- **Triggering**: Claude semantically matches descriptions against user tasks, invokes via `Skill` tool — no `@import` or pointer tables needed\n- **CSO (Claude Search Optimization)**: descriptions MUST start with \"Use when...\" and describe trigger conditions, not capabilities\n- **Third-party / vendored skills**: add an `upstream:` frontmatter block (`source`, `license`, `vendored_at: \"YYYY-MM-DD\"`) when vendoring a skill from an external repo. The block marks the skill as vendored so kit-specific checks (CSO start-prefix, `user-invocable`, `metadata.updated`) are relaxed and the skill's body is preserved verbatim from upstream. Universal structural checks (fenced frontmatter, name matches directory, description length, 500-line body cap) still apply.\n\n<constraint>\nAfter any code change affecting documented patterns, update the relevant skill in `.claude/skills/` and its `metadata.updated` frontmatter field. When introducing something new, create a skill or add a `references/` file to an existing skill.\n</constraint>\n\n## Project Agents\n\nProjects and the global kit may have a `.claude/agents/` directory containing subagent definitions. Each agent file declares its `model` (`sonnet`/`opus`/`haiku`/`inherit`/full model ID), `tools`, and system prompt. Claude Code auto-discovers them at session start and delegates when a `subagent_type` matches or when a slash command explicitly invokes them.\n\nAgent files follow this structure:\n- **Frontmatter**: `name` (kebab-case, matches filename), `description` (CSO — starts \"Use when…\" with a \"Not for…\" exclusion clause), `tools`, `model`\n- **Body** (≤500 lines): `<constraint>` blocks for non-negotiable rules, `## Workflow` with context-acknowledgment as step 1, `## Output Format`, `## Anti-Hallucination Checks`, `## Success Criteria`\n- **Model-selection resolution** (per Claude Code docs): `CLAUDE_CODE_SUBAGENT_MODEL` env var → per-invocation `model` param → agent frontmatter `model:` → parent conversation. The env var is NOT set in this kit, so per-agent frontmatter controls selection.\n\n<constraint>\nWhen adding a new agent: use kebab-case name matching filename, CSO-compliant description (starts \"Use when…\", contains a \"Not\" exclusion clause), explicit `model` and `tools`.\n</constraint>\n\n## Picking the right models for workflows and subagents\n\nRankings, all scores 10 = best. Intelligence is how hard a problem the model can be handed unsupervised. Taste covers UI/UX, code quality, API design, and copy. Budget fit is marginal spend plus quota headroom — a tie-breaker only.\n\n| model | budget fit | intelligence | taste |\n|-------------|------------|--------------|-------|\n| gpt-5.6-sol | 9 | 10 | 6 |\n| fable-5 | 3 | 9 | 9 |\n| opus-4.8 | 5 | 7 | 8 |\n| sonnet-5 | 7 | 5 | 7 |\n\nCapacity: Sol has abundant subscription headroom; Fable is scarce; Opus is moderate; Sonnet is economical. gpt-5.6-sol holds the top intelligence slot — it is the default implementer for plan-sized work. Fable 5 (available again; the kit's Claude default) holds the top taste slot and is the orchestrator/interactive tier, not a bulk executor.\n\nHow to apply:\n- These are defaults, not limits. Standing permission to override: if a cheaper model's output misses the bar, rerun with a smarter one without asking. Judge the output, not the price tag — escalating costs less than shipping mediocre work.\n- Budget fit is a tie-breaker only; when axes conflict for anything that ships, intelligence > taste > budget fit.\n- Implementation of plans, and bulk/mechanical work (clear-spec implementation, data analysis, migrations): gpt-5.6-sol.\n- Anything user-facing (UI, copy, API design) needs taste ≥ 7 → fable-5 or opus-4.8 (sonnet-5 when both are saturated).\n- Reviews of plans/implementations: gpt-5.6-sol, optionally the best available Claude — fable-5 when access allows, opus-4.8 otherwise — as a second independent perspective.\n- Never use Haiku.\n- Claude models run via the Agent/Workflow `model` parameter (`opus`, `sonnet`, `fable` where org access allows).\n\nReaching gpt-5.6-sol — always through the `session-relay` skill (shared bus + `relay` CLI, Claude ⇄ Codex), even for one-shots, so every exchange stays resumable:\n- `relay spawn <dir> --tool codex --model gpt-5.6-sol --effort xhigh` (or `--tool claude --model opus` for a Claude worker in another project), then continue it with `send` / `wake`. Codex runs on its own CLI (`~/.codex/config.toml` defaults to gpt-5.6-sol) and is more efficient than Claude on well-specced execution and stronger at computer-use and UI/UX verification — offload those and report results back.\n- An independent fresh-context review = a NEW spawn (fresh spawn is fresh context). Two independent perspectives on a plan = the red-team pair spawn: a gpt-5.6-sol worker and an opus worker debate over the bus, orchestrator writes the verdict — the concrete form of the \"second independent perspective\" review above.\n- Pin `--model`/`--effort` on every spawn/wake; never leave an unattended relay child on a top interactive default (e.g. Fable). Each spawn/wake bills the target's subscription — spawn deliberately, never in loops.\n\n## Agentic Engineering Discipline\n\n1. **State assumptions; push back when warranted.** If a requirement is ambiguous in a way that changes the deliverable, surface the ambiguity and propose 1–2 concrete interpretations in your first message — do not silently pick one and run with it. Surface inconsistencies and confusion instead of guessing past them; present tradeoffs when approaches genuinely differ; push back when the request looks wrong. Agreeable-but-wrong is the failure mode, not disagreement.\n2. **Minimum code that solves the stated problem.** Each named pattern below is a defect — catch it during generation, not after:\n\n **Code slop**\n - **Defensive guards** around internally-trusted calls (`try`, `if x != null`). Validate at system boundaries only.\n - **Speculative abstraction.** No helper for one caller; no interface for one implementer. Three similar lines beats premature DRY.\n - **Backwards-compat shims** without a caller — re-exports, deprecation aliases, untoggled feature flags. Just change the code.\n - **Half-finished stubs.** `TODO handle later`, `throw new Error('not implemented')`. Implement or remove the path.\n - **Underscore-rename of unused vars.** Delete the var.\n - **Dead code left behind.** After a refactor, delete the paths, helpers, and imports the change made unreachable.\n\n **Comment slop**\n - **Restate-the-code.** `// increment i`. The identifier already says it.\n - **Provenance.** `// added for ticket X`, `// used by Y`. Belongs in the PR description; rots in code.\n - **Tombstones.** `// removed Z`, `// previously did W`. Git remembers.\n - **Docstring bloat** on self-evident functions. One line, only when the WHY isn't obvious from the name.\n\n **Output slop**\n - **End-of-turn diff-restatement.** One or two sentences: what changed, what's next. Don't recap what's in the diff.\n - **Narration tics.** \"Now I'll…\", \"Let me check…\", play-by-play between tool calls. Terse working shorthand between tool calls is fine; play-by-play is not — write a sentence when something load-bearing happens (a finding, a direction change, a blocker).\n - **Compressed final summaries.** The final message is for a reader who didn't watch the work: outcome first, complete sentences. Shorten by dropping detail, never by compressing into fragments or arrow chains.\n3. **Surgical changes only.** Do not modify code, comments, or formatting outside the explicit scope of the request. Surface unrelated issues as follow-ups — do not fix inline.\n4. **State how success will be verified before implementing.** Name the test, build, smoke check, or diff inspection that will prove the change works. Prefer executable criteria — a test that fails before and passes after, a command with expected output — over judgment calls, and keep each change small enough that its diff is reviewable in one sitting.\n5. **Review scope follows the pipeline.** In pipeline reviews with a downstream filter (multi-agent scans, verification phases), report every issue found with confidence and severity — filtering happens downstream. In ad-hoc reviews, flag only gaps that affect correctness or the stated requirements; treat the rest as optional.\n6. **Ground every progress claim in evidence.** Before reporting progress or completion, audit each claim against a tool result from this session — show the test output, the command and what it returned. If something is unverified, say so explicitly; if tests fail, say so with the output.\n\nUse a narrow-to-broad verification ladder: direct acceptance while iterating, focused regressions next, and one full CI at the pre-commit or release boundary. Reuse still-matching evidence; rerun full CI only after a relevant edit invalidates it.\n\n<constraint>\nTreat the six rules above as preventive (during generation), not remedial (after the fact). Self-correct if a turn drifts.\n</constraint>\n",
10
+ "SoT/.claude/CLAUDE.md": "@RTK.md\n\n## Research Before Implementation\n\nBefore writing or modifying code that uses an API, hook, method, or config surface you have not verified in this session, research current documentation first.\n\n**Research workflow:**\n1. Use `resolve-library-id` → `query-docs` (context7) to fetch up-to-date docs for the specific library/framework\n2. If context7 doesn't cover it, read the official docs with `agent-browser` (it reaches JS-rendered, auth-walled, and login-gated pages); fall back to `WebFetch` for a simple static page\n3. Only then proceed to implementation\n\n**When to research:**\n- Installing or configuring a dependency\n- Using an API, hook, method, or pattern you haven't verified in this session\n- Upgrading or migrating between versions\n- Any task where you'd otherwise rely on training data for syntax/behavior\n\n**Do NOT:**\n- Assume API signatures, method names, or config options from memory\n- Generate framework code without checking current docs first\n- Skip research because the library \"seems familiar\"\n\n<constraint>\nResearch the codebase before editing. Never change code you haven't read.\n</constraint>\n\n## Agentic Harness Heuristics\n\n**1. Persistence.** Keep going until the user's query is completely resolved. Only yield when sure the problem is solved. Before ending a turn, check the last paragraph: if it is a plan, a question you can answer yourself, or a promise of work not done (\"I'll…\"), do that work now.\n\n**2. Default to parallel.** Whenever you have multiple independent operations (reads, greps, web fetches, independent edits), invoke them in a single response with multiple tool-use blocks. Sequential calls only when output of one operation is required as input to the next.\n\n**3. Multi-pass search.** First-pass search often misses — vary the wording (colleague-questions over keywords) before concluding something doesn't exist.\n\n**4. Trace symbols.** Before modifying a symbol, trace it to its definitions and all usages. Don't assume a function's behavior or a type's shape from the call site alone.\n\n**5. Linter-loop 3-strike rule.** Don't loop more than 3 times fixing linter errors on the same file. On the third attempt, stop and ask the user — repeated failure usually means the diagnosis is wrong, not the code.\n\n**6. Read-before-Edit TTL.** If you haven't read a file with the Read tool in the last ~5 messages, re-read it before editing. Cached file content goes stale silently when the user edits between turns.\n\n**7. Big-file rule.** For files >1000 lines, prefer Grep + scoped Read (`offset` + `limit`) over reading the entire file. Whole-file reads bloat context; targeted reads keep the working set small.\n\n**8. Todo hygiene.** Use TaskCreate for items with meaningful outcome (≥5 min, distinct deliverable). Never include operational sub-actions (linting, testing, searching, examining the codebase) as their own todos — those are sub-steps in service of higher-level tasks. Mark complete immediately when done, never in batches.\n\n**9. Literal-instruction rule.** Current frontier models follow instructions literally — they do not silently generalize from intent. Phrase requirements as explicit checklists with success criteria, not narrative.\n\n**10. Context hygiene.** Prefer `/clear` at task boundaries and `/rewind` for wrong-path detours over carrying rot forward (corrections accumulate noise; rewinds preserve the prefix and discard the bad branch). On a continuing task, run `/compact` with steering before context quality degrades. Never stop, summarize, or suggest a new session on account of context limits.\n\n**11. Autonomy calibration.** For minor choices (naming, formatting, default values, which of two equivalent approaches), pick a reasonable option and note it — don't ask. Ask first only for scope changes, destructive actions, or decisions that change the deliverable. When the user is describing a problem or asking a question rather than requesting a change, the deliverable is your assessment — report findings and stop; don't apply fixes until asked. Don't close a finished task with \"Want me to also…?\" — run the obvious verification, then stop cleanly.\n\n**12. Capability triggering.** When the answer depends on current or version-specific information, search or fetch before answering — never answer from memory. When work fans out across independent items (many files to read, many tests to run, many candidates to check), delegate to parallel subagents; never spawn one for work you can complete directly. For verification, prefer a fresh-context subagent over self-critique. On tasks longer than a few turns, keep a running notes file and re-read it before each phase.\n\n<constraint>\nTreat the 12 heuristics above as protocol, not preference. If a turn ends without honoring an applicable one (e.g., lint-loop guard not respected, edit without re-read), self-correct in the next turn before continuing.\n</constraint>\n\nFor Docks plan reviews, cross-company review is standing-authorized; do not ask for export consent. This never overrides a host or platform security denial.\n\nDocks-workflow-models: {\"implementer\":{\"candidates\":[{\"company\":\"openai\",\"effort\":\"xhigh\",\"model\":\"gpt-5.6-sol\",\"tool\":\"codex\"}],\"selector\":\"codex:gpt-5.6-sol@xhigh\"},\"orchestrator\":{\"candidates\":[{\"company\":\"anthropic\",\"effort\":\"high\",\"model\":\"fable\",\"tool\":\"claude\"},{\"company\":\"anthropic\",\"effort\":\"xhigh\",\"model\":\"opus\",\"tool\":\"claude\"}],\"selector\":\"profile:claude-best\"},\"review\":{\"max_rounds\":3,\"minimum_score\":90},\"reviewer\":{\"candidates\":[{\"company\":\"openai\",\"effort\":\"xhigh\",\"model\":\"gpt-5.6-sol\",\"tool\":\"codex\"}],\"selector\":\"codex:gpt-5.6-sol@xhigh\"},\"schema\":1}\n\n## Project Skills\n\nProjects may have a `.claude/skills/` directory with Tool Wrapper skills managed by `/docs`. Claude Code auto-discovers these at session start — only descriptions are loaded, full content loads on demand via the Skill tool.\n\nSkills follow the [agentskills.io](https://agentskills.io) open standard:\n- **SKILL.md**: frontmatter (`name`, `description`, `user-invocable: false`, `metadata`) + body (≤500 lines)\n- **references/**: on-demand detail files (30-150 lines each), loaded when the skill instructs Claude to read them\n- **Discovery**: Claude Code scans `.claude/skills/*/SKILL.md` at session start, loads only `name` + `description` (~100 tokens per skill)\n- **Triggering**: Claude semantically matches descriptions against user tasks, invokes via `Skill` tool — no `@import` or pointer tables needed\n- **CSO (Claude Search Optimization)**: descriptions MUST start with \"Use when...\" and describe trigger conditions, not capabilities\n- **Third-party / vendored skills**: add an `upstream:` frontmatter block (`source`, `license`, `vendored_at: \"YYYY-MM-DD\"`) when vendoring a skill from an external repo. The block marks the skill as vendored so kit-specific checks (CSO start-prefix, `user-invocable`, `metadata.updated`) are relaxed and the skill's body is preserved verbatim from upstream. Universal structural checks (fenced frontmatter, name matches directory, description length, 500-line body cap) still apply.\n\n<constraint>\nAfter any code change affecting documented patterns, update the relevant skill in `.claude/skills/` and its `metadata.updated` frontmatter field. When introducing something new, create a skill or add a `references/` file to an existing skill.\n</constraint>\n\n## Project Agents\n\nProjects and the global kit may have a `.claude/agents/` directory containing subagent definitions. Each agent file declares its `model` (`sonnet`/`opus`/`haiku`/`inherit`/full model ID), `tools`, and system prompt. Claude Code auto-discovers them at session start and delegates when a `subagent_type` matches or when a slash command explicitly invokes them.\n\nAgent files follow this structure:\n- **Frontmatter**: `name` (kebab-case, matches filename), `description` (CSO — starts \"Use when…\" with a \"Not for…\" exclusion clause), `tools`, `model`\n- **Body** (≤500 lines): `<constraint>` blocks for non-negotiable rules, `## Workflow` with context-acknowledgment as step 1, `## Output Format`, `## Anti-Hallucination Checks`, `## Success Criteria`\n- **Model-selection resolution** (per Claude Code docs): `CLAUDE_CODE_SUBAGENT_MODEL` env var → per-invocation `model` param → agent frontmatter `model:` → parent conversation. The env var is NOT set in this kit, so per-agent frontmatter controls selection.\n\n<constraint>\nWhen adding a new agent: use kebab-case name matching filename, CSO-compliant description (starts \"Use when…\", contains a \"Not\" exclusion clause), explicit `model` and `tools`.\n</constraint>\n\n## Picking the right models for workflows and subagents\n\nRankings, all scores 10 = best. Intelligence is how hard a problem the model can be handed unsupervised. Taste covers UI/UX, code quality, API design, and copy. Budget fit is marginal spend plus quota headroom — a tie-breaker only.\n\n| model | budget fit | intelligence | taste |\n|-------------|------------|--------------|-------|\n| gpt-5.6-sol | 9 | 10 | 6 |\n| fable-5 | 3 | 9 | 9 |\n| opus-4.8 | 5 | 7 | 8 |\n| sonnet-5 | 7 | 5 | 7 |\n\nCapacity: Sol has abundant subscription headroom; Fable is scarce; Opus is moderate; Sonnet is economical. gpt-5.6-sol holds the top intelligence slot — it is the default implementer for plan-sized work. Fable 5 (available again; the kit's Claude default) holds the top taste slot and is the orchestrator/interactive tier, not a bulk executor.\n\nHow to apply:\n- These are defaults, not limits. Standing permission to override: if a cheaper model's output misses the bar, rerun with a smarter one without asking. Judge the output, not the price tag — escalating costs less than shipping mediocre work.\n- Budget fit is a tie-breaker only; when axes conflict for anything that ships, intelligence > taste > budget fit.\n- Implementation of plans, and bulk/mechanical work (clear-spec implementation, data analysis, migrations): gpt-5.6-sol.\n- Anything user-facing (UI, copy, API design) needs taste ≥ 7 → fable-5 or opus-4.8 (sonnet-5 when both are saturated).\n- Reviews of plans/implementations: gpt-5.6-sol, optionally the best available Claude — fable-5 when access allows, opus-4.8 otherwise — as a second independent perspective.\n- Never use Haiku.\n- Claude models run via the Agent/Workflow `model` parameter (`opus`, `sonnet`, `fable` where org access allows).\n\nReaching gpt-5.6-sol — always through the `session-relay` skill (shared bus + `relay` CLI, Claude ⇄ Codex), even for one-shots, so every exchange stays resumable:\n- `relay spawn <dir> --tool codex --model gpt-5.6-sol --effort xhigh` (or `--tool claude --model opus` for a Claude worker in another project), then continue it with `send` / `wake`. Codex runs on its own CLI (`~/.codex/config.toml` defaults to gpt-5.6-sol) and is more efficient than Claude on well-specced execution and stronger at computer-use and UI/UX verification — offload those and report results back.\n- An independent fresh-context review = a NEW spawn (fresh spawn is fresh context). Two independent perspectives on a plan = the red-team pair spawn: a gpt-5.6-sol worker and an opus worker debate over the bus, orchestrator writes the verdict — the concrete form of the \"second independent perspective\" review above.\n- Pin `--model`/`--effort` on every spawn/wake; never leave an unattended relay child on a top interactive default (e.g. Fable). Each spawn/wake bills the target's subscription — spawn deliberately, never in loops.\n\n## Agentic Engineering Discipline\n\n1. **State assumptions; push back when warranted.** If a requirement is ambiguous in a way that changes the deliverable, surface the ambiguity and propose 1–2 concrete interpretations in your first message — do not silently pick one and run with it. Surface inconsistencies and confusion instead of guessing past them; present tradeoffs when approaches genuinely differ; push back when the request looks wrong. Agreeable-but-wrong is the failure mode, not disagreement.\n2. **Minimum code that solves the stated problem.** Each named pattern below is a defect — catch it during generation, not after:\n\n **Code slop**\n - **Defensive guards** around internally-trusted calls (`try`, `if x != null`). Validate at system boundaries only.\n - **Speculative abstraction.** No helper for one caller; no interface for one implementer. Three similar lines beats premature DRY.\n - **Backwards-compat shims** without a caller — re-exports, deprecation aliases, untoggled feature flags. Just change the code.\n - **Half-finished stubs.** `TODO handle later`, `throw new Error('not implemented')`. Implement or remove the path.\n - **Underscore-rename of unused vars.** Delete the var.\n - **Dead code left behind.** After a refactor, delete the paths, helpers, and imports the change made unreachable.\n\n **Comment slop**\n - **Restate-the-code.** `// increment i`. The identifier already says it.\n - **Provenance.** `// added for ticket X`, `// used by Y`. Belongs in the PR description; rots in code.\n - **Tombstones.** `// removed Z`, `// previously did W`. Git remembers.\n - **Docstring bloat** on self-evident functions. One line, only when the WHY isn't obvious from the name.\n\n **Output slop**\n - **End-of-turn diff-restatement.** One or two sentences: what changed, what's next. Don't recap what's in the diff.\n - **Narration tics.** \"Now I'll…\", \"Let me check…\", play-by-play between tool calls. Terse working shorthand between tool calls is fine; play-by-play is not — write a sentence when something load-bearing happens (a finding, a direction change, a blocker).\n - **Compressed final summaries.** The final message is for a reader who didn't watch the work: outcome first, complete sentences. Shorten by dropping detail, never by compressing into fragments or arrow chains.\n3. **Surgical changes only.** Do not modify code, comments, or formatting outside the explicit scope of the request. Surface unrelated issues as follow-ups — do not fix inline.\n4. **State how success will be verified before implementing.** Name the test, build, smoke check, or diff inspection that will prove the change works. Prefer executable criteria — a test that fails before and passes after, a command with expected output — over judgment calls, and keep each change small enough that its diff is reviewable in one sitting.\n5. **Review scope follows the pipeline.** In pipeline reviews with a downstream filter (multi-agent scans, verification phases), report every issue found with confidence and severity — filtering happens downstream. In ad-hoc reviews, flag only gaps that affect correctness or the stated requirements; treat the rest as optional.\n6. **Ground every progress claim in evidence.** Before reporting progress or completion, audit each claim against a tool result from this session — show the test output, the command and what it returned. If something is unverified, say so explicitly; if tests fail, say so with the output.\n\nUse a narrow-to-broad verification ladder: direct acceptance while iterating, focused regressions next, and one full CI at the pre-commit or release boundary. Reuse still-matching evidence; rerun full CI only after a relevant edit invalidates it.\n\n<constraint>\nTreat the six rules above as preventive (during generation), not remedial (after the fact). Self-correct if a turn drifts.\n</constraint>\n",
11
11
  "SoT/.claude/mcp-servers.json": "{\n \"mcpServers\": {\n \"chrome-devtools\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"-y\", \"chrome-devtools-mcp@1.5.0\"],\n \"env\": {}\n }\n }\n}\n",
12
- "SoT/.claude/settings.json": "{\n \"$schema\": \"https://json.schemastore.org/claude-code-settings.json\",\n \"minimumVersion\": \"2.1.170\",\n \"model\": \"fable\",\n \"effortLevel\": \"high\",\n \"autoMemoryEnabled\": true,\n \"skillListingMaxDescChars\": 2048,\n \"respectGitignore\": true,\n \"cleanupPeriodDays\": 14,\n \"skillListingBudgetFraction\": 0.05,\n \"env\": {\n \"CLAUDE_CODE_MAX_OUTPUT_TOKENS\": \"64000\",\n \"CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR\": \"1\",\n \"CLAUDE_CODE_AUTO_COMPACT_WINDOW\": \"468000\",\n \"CLAUDE_CODE_NO_FLICKER\": \"1\"\n },\n \"permissions\": {\n \"defaultMode\": \"auto\",\n \"allow\": [\n \"Read\",\n \"Glob\",\n \"Grep\",\n \"WebFetch\",\n \"WebSearch\",\n \"Edit(./)\",\n \"Write(./)\",\n \"Bash(git *)\",\n \"Bash(git add *)\",\n \"Bash(git commit *)\",\n \"Bash(git status *)\",\n \"Bash(git diff *)\",\n \"Bash(git log *)\",\n \"Bash(git branch *)\",\n \"Bash(git checkout *)\",\n \"Bash(git switch *)\",\n \"Bash(git stash *)\",\n \"Bash(git fetch *)\",\n \"Bash(git pull *)\",\n \"Bash(git tag *)\",\n \"Bash(git show *)\",\n \"Bash(git blame *)\",\n \"Bash(git worktree *)\",\n \"Bash(gh *)\",\n \"Bash(pnpm *)\",\n \"Bash(npm *)\",\n \"Bash(npx *)\",\n \"Bash(node *)\",\n \"Bash(docker *)\",\n \"Bash(docker-compose *)\",\n \"Bash(rtk *)\",\n \"Bash(ls *)\",\n \"Bash(cat *)\",\n \"Bash(find *)\",\n \"Bash(grep *)\",\n \"Bash(head *)\",\n \"Bash(tail *)\",\n \"Bash(wc *)\",\n \"Bash(sort *)\",\n \"Bash(uniq *)\",\n \"Bash(diff *)\",\n \"Bash(which *)\",\n \"Bash(pwd *)\",\n \"Bash(date *)\",\n \"Bash(mkdir *)\",\n \"Bash(basename *)\",\n \"Bash(dirname *)\",\n \"Bash(realpath *)\",\n \"Bash(jq *)\",\n \"Bash(curl *)\",\n \"Bash(tree *)\",\n \"Bash(sed *)\",\n \"Bash(awk *)\",\n \"Bash(cut *)\",\n \"Bash(tr *)\",\n \"Bash(tee *)\",\n \"Bash(echo *)\",\n \"Bash(printf *)\",\n \"Bash(env *)\",\n \"Bash(printenv *)\",\n \"Bash(uname *)\",\n \"Bash(file *)\",\n \"Bash(stat *)\",\n \"Bash(du *)\",\n \"Bash(id *)\",\n \"Bash(whoami *)\",\n \"Bash(php *)\",\n \"Bash(composer *)\",\n \"Bash(python3 *)\",\n \"Bash(python *)\",\n \"Bash(pip *)\",\n \"Bash(pip3 *)\"\n ],\n \"deny\": [\n \"Read(**/.env)\",\n \"Read(**/.env.local)\",\n \"Read(**/secrets/**)\",\n \"Read(**/*.key)\",\n \"Read(**/*.pem)\",\n \"Read(**/*.p12)\",\n \"Read(**/.credentials*)\",\n \"Edit(**/.env)\",\n \"Edit(**/.env.local)\",\n \"Edit(**/secrets/**)\",\n \"Write(**/.env)\",\n \"Write(**/.env.local)\",\n \"Write(**/secrets/**)\",\n \"Bash(sudo *)\",\n \"Bash(rm -rf /)\",\n \"Bash(rm -rf / *)\",\n \"Bash(rm -rf ~)\",\n \"Bash(rm -rf ~ *)\",\n \"Bash(rm -rf $HOME)\",\n \"Bash(rm -rf $HOME *)\",\n \"Bash(> /dev *)\",\n \"Bash(dd if= *)\",\n \"Bash(mkfs *)\",\n \"Bash(eval *)\",\n \"Bash(chmod 777 *)\",\n \"Bash(chmod -R 777 *)\",\n \"Bash(git push --force origin main *)\",\n \"Bash(git push --force origin master *)\",\n \"Bash(git push -f origin main *)\",\n \"Bash(git push -f origin master *)\"\n ],\n \"ask\": [\n \"Bash(git clean *)\",\n \"Bash(docker volume rm *)\",\n \"Bash(docker system prune *)\"\n ]\n },\n \"hooks\": {\n \"SessionStart\": [\n {\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"__DOCKS_KIT_BUN__\",\n \"args\": [\"__DOCKS_KIT_SESSION_START__\"],\n \"timeout\": 5\n }\n ]\n }\n ],\n \"Notification\": [\n {\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"__DOCKS_KIT_BUN__\",\n \"args\": [\"__DOCKS_KIT_NOTIFY__\"],\n \"timeout\": 10,\n \"async\": true\n }\n ]\n }\n ],\n \"PreToolUse\": [\n {\n \"matcher\": \"Bash\",\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"rtk hook claude\"\n }\n ]\n }\n ],\n \"PostToolUseFailure\": [\n {\n \"matcher\": \"Bash\",\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"echo '{\\\"hookSpecificOutput\\\":{\\\"hookEventName\\\":\\\"PostToolUseFailure\\\",\\\"additionalContext\\\":\\\"Last bash command failed. Repository / file state may have shifted \\u2014 re-read affected files before retrying. If the failure is a missing dependency or env mismatch, surface it to the user rather than retrying blindly.\\\"}}'\",\n \"timeout\": 5\n }\n ]\n }\n ],\n \"SubagentStop\": [\n {\n \"hooks\": [\n {\n \"type\": \"prompt\",\n \"prompt\": \"You are a quality gate for subagent outputs in a multi-agent code-analysis pipeline.\\n\\nEvaluate the subagent's `last_assistant_message` field (in the JSON below) against these requirements:\\n\\n1. ALLOW (return `{}`): Mode-selection or no-issues responses. Examples: \\\"Which mode do you prefer\\\", \\\"select an option\\\", \\\"no issues / problems / violations / blockers found\\\".\\n\\n2. ALLOW (return `{}`): Output contains at least one concrete file:line citation \\u2014 e.g. `src/auth.ts:42`, `lib/db.ts:100-115`, or path references that include line numbers.\\n\\n3. BLOCK (return `{\\\"decision\\\":\\\"block\\\",\\\"reason\\\":\\\"<one-line explanation>\\\"}`): Output claims about code or findings WITHOUT concrete file:line citations. Vague references like \\\"the auth handler\\\" or \\\"near the database code\\\" are not acceptable as the only evidence.\\n\\nSubagent invocation JSON:\\n$ARGUMENTS\\n\\nReturn ONLY the JSON decision (no commentary, no markdown fences).\",\n \"timeout\": 30\n }\n ]\n }\n ]\n },\n \"statusLine\": {\n \"type\": \"command\",\n \"command\": \"__DOCKS_KIT_STATUSLINE__\",\n \"refreshInterval\": 5\n },\n \"enabledPlugins\": {\n \"context7@claude-plugins-official\": true,\n \"frontend-design@claude-plugins-official\": true,\n \"php-lsp@claude-plugins-official\": true,\n \"typescript-lsp@claude-plugins-official\": true,\n \"docks@docks\": true,\n \"session-relay@docks\": true,\n \"effect-kit@docks\": true\n },\n \"extraKnownMarketplaces\": {\n \"docks\": {\n \"source\": {\n \"source\": \"github\",\n \"repo\": \"DocksDocks/docks\"\n }\n }\n },\n \"alwaysThinkingEnabled\": true,\n \"showThinkingSummaries\": true,\n \"viewMode\": \"default\",\n \"theme\": \"dark-daltonized\",\n \"skipDangerousModePermissionPrompt\": true\n}\n",
12
+ "SoT/.claude/settings.json": "{\n \"$schema\": \"https://json.schemastore.org/claude-code-settings.json\",\n \"minimumVersion\": \"2.1.170\",\n \"model\": \"fable\",\n \"effortLevel\": \"high\",\n \"autoMemoryEnabled\": true,\n \"skillListingMaxDescChars\": 2048,\n \"respectGitignore\": true,\n \"cleanupPeriodDays\": 14,\n \"skillListingBudgetFraction\": 0.05,\n \"env\": {\n \"CLAUDE_CODE_MAX_OUTPUT_TOKENS\": \"64000\",\n \"CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR\": \"1\",\n \"CLAUDE_CODE_AUTO_COMPACT_WINDOW\": \"468000\",\n \"CLAUDE_CODE_NO_FLICKER\": \"1\"\n },\n \"permissions\": {\n \"defaultMode\": \"auto\",\n \"allow\": [\n \"Read\",\n \"Glob\",\n \"Grep\",\n \"WebFetch\",\n \"WebSearch\",\n \"Edit(./)\",\n \"Bash(git *)\",\n \"Bash(git add *)\",\n \"Bash(git commit *)\",\n \"Bash(git status *)\",\n \"Bash(git diff *)\",\n \"Bash(git log *)\",\n \"Bash(git branch *)\",\n \"Bash(git checkout *)\",\n \"Bash(git switch *)\",\n \"Bash(git stash *)\",\n \"Bash(git fetch *)\",\n \"Bash(git pull *)\",\n \"Bash(git tag *)\",\n \"Bash(git show *)\",\n \"Bash(git blame *)\",\n \"Bash(git worktree *)\",\n \"Bash(gh *)\",\n \"Bash(pnpm *)\",\n \"Bash(npm *)\",\n \"Bash(npx *)\",\n \"Bash(node *)\",\n \"Bash(docker *)\",\n \"Bash(docker-compose *)\",\n \"Bash(rtk *)\",\n \"Bash(ls *)\",\n \"Bash(cat *)\",\n \"Bash(find *)\",\n \"Bash(grep *)\",\n \"Bash(head *)\",\n \"Bash(tail *)\",\n \"Bash(wc *)\",\n \"Bash(sort *)\",\n \"Bash(uniq *)\",\n \"Bash(diff *)\",\n \"Bash(which *)\",\n \"Bash(pwd *)\",\n \"Bash(date *)\",\n \"Bash(mkdir *)\",\n \"Bash(basename *)\",\n \"Bash(dirname *)\",\n \"Bash(realpath *)\",\n \"Bash(jq *)\",\n \"Bash(curl *)\",\n \"Bash(tree *)\",\n \"Bash(sed *)\",\n \"Bash(awk *)\",\n \"Bash(cut *)\",\n \"Bash(tr *)\",\n \"Bash(tee *)\",\n \"Bash(echo *)\",\n \"Bash(printf *)\",\n \"Bash(env *)\",\n \"Bash(printenv *)\",\n \"Bash(uname *)\",\n \"Bash(file *)\",\n \"Bash(stat *)\",\n \"Bash(du *)\",\n \"Bash(id *)\",\n \"Bash(whoami *)\",\n \"Bash(php *)\",\n \"Bash(composer *)\",\n \"Bash(python3 *)\",\n \"Bash(python *)\",\n \"Bash(pip *)\",\n \"Bash(pip3 *)\"\n ],\n \"deny\": [\n \"Read(**/.env)\",\n \"Read(**/.env.local)\",\n \"Read(**/secrets/**)\",\n \"Read(**/*.key)\",\n \"Read(**/*.pem)\",\n \"Read(**/*.p12)\",\n \"Read(**/.credentials*)\",\n \"Edit(**/.env)\",\n \"Edit(**/.env.local)\",\n \"Edit(**/secrets/**)\",\n \"Bash(sudo *)\",\n \"Bash(rm -rf /)\",\n \"Bash(rm -rf / *)\",\n \"Bash(rm -rf ~)\",\n \"Bash(rm -rf ~ *)\",\n \"Bash(rm -rf $HOME)\",\n \"Bash(rm -rf $HOME *)\",\n \"Bash(> /dev *)\",\n \"Bash(dd if= *)\",\n \"Bash(mkfs *)\",\n \"Bash(eval *)\",\n \"Bash(chmod 777 *)\",\n \"Bash(chmod -R 777 *)\",\n \"Bash(git push --force origin main *)\",\n \"Bash(git push --force origin master *)\",\n \"Bash(git push -f origin main *)\",\n \"Bash(git push -f origin master *)\"\n ],\n \"ask\": [\n \"Bash(git clean *)\",\n \"Bash(docker volume rm *)\",\n \"Bash(docker system prune *)\"\n ]\n },\n \"hooks\": {\n \"SessionStart\": [\n {\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"__DOCKS_KIT_BUN__\",\n \"args\": [\"__DOCKS_KIT_SESSION_START__\"],\n \"timeout\": 5\n }\n ]\n }\n ],\n \"Notification\": [\n {\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"__DOCKS_KIT_BUN__\",\n \"args\": [\"__DOCKS_KIT_NOTIFY__\"],\n \"timeout\": 10,\n \"async\": true\n }\n ]\n }\n ],\n \"PreToolUse\": [\n {\n \"matcher\": \"Bash\",\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"rtk hook claude\"\n }\n ]\n }\n ],\n \"PostToolUseFailure\": [\n {\n \"matcher\": \"Bash\",\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"echo '{\\\"hookSpecificOutput\\\":{\\\"hookEventName\\\":\\\"PostToolUseFailure\\\",\\\"additionalContext\\\":\\\"Last bash command failed. Repository / file state may have shifted \\u2014 re-read affected files before retrying. If the failure is a missing dependency or env mismatch, surface it to the user rather than retrying blindly.\\\"}}'\",\n \"timeout\": 5\n }\n ]\n }\n ],\n \"SubagentStop\": [\n {\n \"hooks\": [\n {\n \"type\": \"prompt\",\n \"prompt\": \"You are a quality gate for subagent outputs in a multi-agent code-analysis pipeline.\\n\\nEvaluate the subagent's `last_assistant_message` field (in the JSON below) against these requirements:\\n\\n1. ALLOW (return `{}`): Mode-selection or no-issues responses. Examples: \\\"Which mode do you prefer\\\", \\\"select an option\\\", \\\"no issues / problems / violations / blockers found\\\".\\n\\n2. ALLOW (return `{}`): Output contains at least one concrete file:line citation \\u2014 e.g. `src/auth.ts:42`, `lib/db.ts:100-115`, or path references that include line numbers.\\n\\n3. BLOCK (return `{\\\"decision\\\":\\\"block\\\",\\\"reason\\\":\\\"<one-line explanation>\\\"}`): Output claims about code or findings WITHOUT concrete file:line citations. Vague references like \\\"the auth handler\\\" or \\\"near the database code\\\" are not acceptable as the only evidence.\\n\\nSubagent invocation JSON:\\n$ARGUMENTS\\n\\nReturn ONLY the JSON decision (no commentary, no markdown fences).\",\n \"timeout\": 30\n }\n ]\n }\n ]\n },\n \"statusLine\": {\n \"type\": \"command\",\n \"command\": \"__DOCKS_KIT_STATUSLINE__\",\n \"refreshInterval\": 5\n },\n \"enabledPlugins\": {\n \"context7@claude-plugins-official\": true,\n \"frontend-design@claude-plugins-official\": true,\n \"php-lsp@claude-plugins-official\": true,\n \"typescript-lsp@claude-plugins-official\": true,\n \"docks@docks\": true,\n \"session-relay@docks\": true,\n \"effect-kit@docks\": true\n },\n \"extraKnownMarketplaces\": {\n \"docks\": {\n \"source\": {\n \"source\": \"github\",\n \"repo\": \"DocksDocks/docks\"\n }\n }\n },\n \"alwaysThinkingEnabled\": true,\n \"showThinkingSummaries\": true,\n \"viewMode\": \"default\",\n \"theme\": \"dark-daltonized\",\n \"skipDangerousModePermissionPrompt\": true\n}\n",
13
13
  "SoT/.claude/bin/statusline.mjs": "const ESC = \"\\x1b[\"\nconst PIPE = `${ESC}90m | ${ESC}0m`\nconst DOT = `${ESC}90m • ${ESC}0m`\nconst DIM = `${ESC}2m${ESC}38;2;156;162;175m`\n\nfunction isRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction finitePercentage(value) {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0 && value <= 100\n ? value\n : undefined\n}\n\nfunction roundHalfEven(value) {\n const lower = Math.floor(value)\n const fraction = value - lower\n if (fraction < 0.5) return lower\n if (fraction > 0.5) return lower + 1\n return lower % 2 === 0 ? lower : lower + 1\n}\n\nfunction pathBasename(path) {\n const parts = path.split(/[\\\\/]+/).filter((part) => part !== \"\")\n return parts.at(-1) ?? \"\"\n}\n\nfunction modelName(input) {\n const model = isRecord(input.model) && typeof input.model.display_name === \"string\"\n ? input.model.display_name\n : \"\"\n const suffix = model.indexOf(\" (\")\n return suffix === -1 ? model : model.slice(0, suffix)\n}\n\nfunction workingDirectory(input, cwd) {\n if (isRecord(input.workspace) && typeof input.workspace.current_dir === \"string\" && input.workspace.current_dir !== \"\") {\n return input.workspace.current_dir\n }\n if (typeof input.cwd === \"string\" && input.cwd !== \"\") return input.cwd\n return cwd\n}\n\nfunction compactWindow(env, total) {\n const raw = env.CLAUDE_CODE_AUTO_COMPACT_WINDOW\n if (typeof raw !== \"string\" || !/^[0-9]+$/.test(raw)) return total\n const parsed = Number(raw)\n return Number.isSafeInteger(parsed) && parsed >= 1000 && parsed < total ? parsed : total\n}\n\nfunction formatTokensK(value) {\n if (value < 1000) return `${value}k`\n if (value % 1000 === 0) return `${value / 1000}M`\n return `${(roundHalfEven(value / 100) / 10).toFixed(1)}M`\n}\n\nfunction contextSegment(input, env) {\n if (!isRecord(input.context_window)) return \"\"\n const used = finitePercentage(input.context_window.used_percentage)\n if (used === undefined) return \"\"\n\n const total = input.context_window.context_window_size\n if (typeof total !== \"number\" || !Number.isFinite(total) || total <= 0) {\n return `${ESC}38;2;130;160;230mctx ${roundHalfEven(used)}%${ESC}0m`\n }\n\n const usedK = roundHalfEven((used / 100) * (total / 1000))\n const effectiveK = Math.trunc(compactWindow(env, total) / 1000)\n if (effectiveK <= 0) return `${ESC}38;2;130;160;230mctx ${roundHalfEven(used)}%${ESC}0m`\n const effectivePercentage = roundHalfEven((usedK / effectiveK) * 100)\n return `${ESC}38;2;130;160;230mctx ${effectivePercentage}%${ESC}0m ${DIM}(${formatTokensK(usedK)}/${formatTokensK(effectiveK)})${ESC}0m`\n}\n\nfunction resetDelta(value, nowMs) {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) return \"\"\n const seconds = Math.trunc(value) - Math.floor(nowMs / 1000)\n if (seconds <= 0) return \"now\"\n const days = Math.trunc(seconds / 86_400)\n if (days > 0) return `${days}d`\n const hours = Math.trunc((seconds % 86_400) / 3_600)\n if (hours > 0) return `${hours}h`\n return `${Math.trunc((seconds % 3_600) / 60)}m`\n}\n\nfunction quotaWindow(value, label, color, nowMs) {\n if (!isRecord(value)) return \"\"\n const used = finitePercentage(value.used_percentage)\n if (used === undefined) return \"\"\n const delta = resetDelta(value.resets_at, nowMs)\n const reset = delta === \"\" ? \"\" : ` ${DIM}(${delta})${ESC}0m`\n return `${ESC}38;2;${color}m${label} ${roundHalfEven(used)}%${ESC}0m${reset}`\n}\n\nfunction decodeStdout(result) {\n const stdout = result?.stdout\n if (stdout === undefined || stdout === null) return \"\"\n return typeof stdout === \"string\" ? stdout : stdout.toString()\n}\n\nfunction resolveBranch(directory, which, spawnSync) {\n const git = which(\"git\")\n if (typeof git !== \"string\" || git === \"\") return \"\"\n const commands = [\n [git, \"-C\", directory, \"symbolic-ref\", \"--short\", \"HEAD\"],\n [git, \"-C\", directory, \"rev-parse\", \"--short\", \"HEAD\"]\n ]\n for (const command of commands) {\n try {\n const result = spawnSync(command, { stdin: \"ignore\", stdout: \"pipe\", stderr: \"ignore\" })\n if (result?.success === true) return decodeStdout(result).trim()\n } catch {\n return \"\"\n }\n }\n return \"\"\n}\n\nexport function formatStatusline(input, options = {}) {\n if (!isRecord(input)) return \"\"\n const env = isRecord(options.env) ? options.env : process.env\n const nowMs = typeof options.nowMs === \"number\" ? options.nowMs : Date.now()\n const cwd = typeof options.cwd === \"string\" ? options.cwd : process.cwd()\n const branch = typeof options.branch === \"string\" ? options.branch : \"\"\n const directory = workingDirectory(input, cwd)\n\n const model = `${ESC}38;5;208m${ESC}1m${modelName(input)}${ESC}22m${ESC}0m`\n const folder = `${ESC}1m${ESC}38;2;76;208;222m${pathBasename(directory)}${ESC}22m${ESC}0m`\n const branchSegment = branch === \"\" ? \"\" : `${DOT}${ESC}1m${ESC}38;2;192;103;222m${branch}${ESC}22m${ESC}0m`\n const context = contextSegment(input, env)\n\n const rateLimits = isRecord(input.rate_limits) ? input.rate_limits : {}\n const fiveHour = quotaWindow(rateLimits.five_hour, \"5h\", \"100;200;200\", nowMs)\n const sevenDay = quotaWindow(rateLimits.seven_day, \"7d\", \"230;180;90\", nowMs)\n const quota = fiveHour === \"\" && sevenDay === \"\"\n ? \"\"\n : `${PIPE}${fiveHour}${fiveHour !== \"\" && sevenDay !== \"\" ? DOT : \"\"}${sevenDay}`\n\n return `${model}${PIPE}${folder}${branchSegment}${context === \"\" ? \"\" : `${PIPE}${context}`}${quota}`\n}\n\nexport async function main(options = {}) {\n const readStdin = options.readStdin ?? (() => Bun.stdin.text())\n const writeStdout = options.writeStdout ?? ((value) => process.stdout.write(value))\n let raw\n try {\n raw = await readStdin()\n } catch {\n return 0\n }\n\n let input\n try {\n input = JSON.parse(raw)\n } catch {\n return 0\n }\n if (!isRecord(input)) return 0\n\n const cwd = typeof options.cwd === \"string\" ? options.cwd : process.cwd()\n const directory = workingDirectory(input, cwd)\n const branch = resolveBranch(\n directory,\n options.which ?? ((name) => Bun.which(name)),\n options.spawnSync ?? ((argv, spawnOptions) => Bun.spawnSync(argv, spawnOptions))\n )\n const output = formatStatusline(input, {\n env: options.env ?? process.env,\n nowMs: options.nowMs ?? Date.now(),\n cwd,\n branch\n })\n if (output !== \"\") writeStdout(`${output}\\n`)\n return 0\n}\n\nif (import.meta.main) process.exit(await main())\n",
14
14
  "SoT/.claude/bin/session-start.mjs": "import { readFileSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\n\nfunction isRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction nonEmpty(value, fallback) {\n return typeof value === \"string\" && value !== \"\" ? value : fallback\n}\n\nfunction pad(value) {\n return String(value).padStart(2, \"0\")\n}\n\nfunction configuredEffort(home, readText) {\n try {\n const parsed = JSON.parse(readText(`${home}/.claude/settings.json`))\n return isRecord(parsed) ? nonEmpty(parsed.effortLevel, \"default\") : \"default\"\n } catch {\n return \"default\"\n }\n}\n\nfunction localZone(now) {\n const part = new Intl.DateTimeFormat(\"en-US\", { timeZoneName: \"short\" })\n .formatToParts(now)\n .find((value) => value.type === \"timeZoneName\")\n return part?.value ?? \"\"\n}\n\nexport function sessionStartLines(options = {}) {\n const env = isRecord(options.env) ? options.env : process.env\n const now = options.now instanceof Date ? options.now : new Date()\n const home = typeof options.home === \"string\" ? options.home : homedir()\n const readText = options.readText ?? ((path) => readFileSync(path, \"utf8\"))\n const weekday = new Intl.DateTimeFormat(\"en-US\", { weekday: \"long\" }).format(now)\n const date = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`\n const time = `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`\n const effort = nonEmpty(env.CLAUDE_CODE_EFFORT_LEVEL, configuredEffort(home, readText))\n const context = env.CLAUDE_CODE_DISABLE_1M_CONTEXT === \"1\" ? \"200K\" : \"1M\"\n const compactWindow = nonEmpty(env.CLAUDE_CODE_AUTO_COMPACT_WINDOW, \"full\")\n const subagent = nonEmpty(env.CLAUDE_CODE_SUBAGENT_MODEL, \"default\")\n return [\n `[CONTEXT] Current date: ${weekday}, ${date} ${time} ${localZone(now)}`,\n `[CONFIG] Context: ${context} | Compact-window: ${compactWindow} | Effort: ${effort} | Thinking: adaptive | Subagent: ${subagent}`\n ]\n}\n\nexport async function main(options = {}) {\n const writeStdout = options.writeStdout ?? ((value) => process.stdout.write(value))\n writeStdout(`${sessionStartLines(options).join(\"\\n\")}\\n`)\n return 0\n}\n\nif (import.meta.main) process.exit(await main())\n",
15
15
  "SoT/.claude/bin/notify.mjs": "const DEFAULT_SOUND = `${import.meta.dir}/../notification.mp3`\n\nexport function selectPlayer(options = {}) {\n const platform = options.platform ?? process.platform\n const sound = options.sound ?? DEFAULT_SOUND\n const which = options.which ?? ((name) => Bun.which(name))\n if (platform === \"darwin\") {\n const afplay = which(\"afplay\")\n if (typeof afplay === \"string\" && afplay !== \"\") return [afplay, sound]\n }\n const ffplay = which(\"ffplay\")\n if (typeof ffplay === \"string\" && ffplay !== \"\") {\n return [ffplay, \"-nodisp\", \"-autoexit\", \"-loglevel\", \"quiet\", sound]\n }\n const paplay = which(\"paplay\")\n if (typeof paplay === \"string\" && paplay !== \"\") return [paplay, sound]\n const aplay = which(\"aplay\")\n if (typeof aplay === \"string\" && aplay !== \"\") return [aplay, \"-q\", sound]\n return undefined\n}\n\nexport async function main(options = {}) {\n const sound = options.sound ?? DEFAULT_SOUND\n const fileExists = options.fileExists ?? ((path) => Bun.file(path).exists())\n if (!await fileExists(sound)) return 0\n const command = selectPlayer({ ...options, sound })\n if (command === undefined) return 0\n const spawnSync = options.spawnSync ?? ((argv, spawnOptions) => Bun.spawnSync(argv, spawnOptions))\n const result = spawnSync(command, { stdin: \"ignore\", stdout: \"ignore\", stderr: \"ignore\" })\n return typeof result.exitCode === \"number\" ? result.exitCode : 1\n}\n\nif (import.meta.main) process.exit(await main())\n",
16
- "SoT/.codex/AGENTS.md": "# AGENTS.md\n\n## Research Before Implementation\n\nBefore writing or modifying code that uses an API, hook, method, or config surface you have not verified in this session, research current documentation first.\n\nResearch workflow:\n1. Prefer official documentation and primary sources for the specific library, framework, or API.\n2. If a local docs or MCP tool is available, use it before broad web search.\n3. Only then proceed to implementation.\n\nResearch when:\n- Installing or configuring a dependency.\n- Using an API, hook, method, or pattern not verified in this session.\n- Upgrading or migrating between versions.\n- Any task where relying on memory could cause stale syntax or behavior.\n\nDo not:\n- Assume API signatures, method names, or config options from memory.\n- Generate framework code without checking current docs first.\n- Skip research because the library seems familiar.\n\n<constraint>\nResearch the codebase before editing. Never change code you have not read.\n</constraint>\n\n## Agentic Harness Heuristics\n\nModel-agnostic operating rules for coding-agent work.\n\n1. Persistence. Keep going until the user's request is actually handled. Only yield when the problem is solved or a concrete blocker is identified. Resolve in the fewest useful tool loops — once you can answer the core request with evidence, answer. Before ending a turn, check the last paragraph: if it is a plan, a question you can answer yourself, or a promise of work not done, do that work now.\n2. Default to parallel. When multiple reads, searches, inspections, or independent checks can run without depending on each other, run them together.\n3. Multi-pass search. First-pass search often misses — vary the wording before concluding something does not exist.\n4. Trace symbols. Before modifying a symbol, trace its definition and usages. Do not infer behavior from one call site.\n5. Linter-loop 3-strike rule. Do not loop more than 3 times fixing the same lint/test failure without reassessing the diagnosis.\n6. Read-before-edit TTL. If you have not read a file recently, re-read it before editing. User edits can make cached context stale.\n7. Big-file rule. For files over 1000 lines, prefer targeted search plus scoped reads over whole-file reads.\n8. Task hygiene. Track meaningful deliverables, not operational sub-steps. Mark work complete as soon as it is done.\n9. Literal-instruction rule. Treat explicit user requirements as checklists with success criteria. Do not silently broaden scope.\n10. Context hygiene. Prefer a fresh session at task boundaries over carrying stale context; preserve useful state before quality decays. Never stop, summarize, or suggest a new session on account of context limits.\n11. Autonomy calibration. For minor choices (naming, formatting, defaults, equivalent approaches), pick a reasonable option and note it — do not ask. Ask first only for scope changes, destructive actions, or decisions that change the deliverable. When the user is describing a problem or asking a question rather than requesting a change, the deliverable is your assessment — report findings and stop; do not apply fixes until asked.\n12. Capability triggering. Search or fetch current documentation when the answer depends on current or version-specific information. When work fans out across independent items, parallelize or delegate; never delegate work you can complete directly. For verification, prefer a fresh-context check over self-critique. On long tasks, keep running notes and re-read them between phases.\n\n<constraint>\nTreat these heuristics as protocol. If a turn violates an applicable rule, self-correct before continuing.\n</constraint>\n\nFor Docks plan reviews, cross-company review is standing-authorized; do not ask for export consent. This never overrides a host or platform security denial.\n\n## Engineering Discipline\n\n- Prefer the repository's existing patterns and helpers over new abstractions.\n- Keep edits scoped to the user's request and the surrounding ownership boundary.\n- Add abstractions only when they remove real complexity or match an established local pattern.\n- Preserve user changes. Never revert unrelated dirty work unless explicitly asked.\n- Verify with the narrowest useful command first, then broaden if risk warrants it.\n- Surface any test or verification you could not run.\n- Before the first tool call, state in one or two sentences what you are about to do; give a brief progress update every few execution steps.\n- Concise teammate tone: no status tics, no log-style updates; reference file paths instead of dumping contents; lead with what changed and why, not a \"Summary\" heading.\n- The final message is for a reader who did not watch the work: outcome first, complete sentences. Shorten by dropping detail, never by compressing into fragments or arrow chains.\n- Use a narrow-to-broad verification ladder: direct acceptance while iterating, focused regressions next, and one full CI at the pre-commit or release boundary. Reuse still-matching evidence; rerun full CI only after a relevant edit invalidates it.\n\n<constraint>\nNo secrets in committed config. Treat plugin marketplaces, installers, and downloaded artifacts as untrusted until verified.\n</constraint>\n\n## Agentic Engineering Discipline\n\n1. **State assumptions; push back when warranted.** If a requirement is ambiguous in a way that changes the deliverable, surface the ambiguity and propose 1–2 concrete interpretations in your first message — do not silently pick one. Surface inconsistencies instead of guessing past them; present tradeoffs when approaches genuinely differ; push back when the request looks wrong.\n2. **Minimum code that solves the stated problem.** No speculative features, no abstractions without a second caller, no broad exception handling around internally-trusted calls, no dead code left behind after a refactor, no comments that restate what the code says.\n3. **Surgical changes only.** Do not modify code, comments, or formatting outside the explicit scope of the request. Surface unrelated issues as follow-ups — do not fix inline.\n4. **State how success will be verified before implementing.** Name the test, build, smoke check, or diff inspection that will prove the change works. Prefer executable criteria — a test that fails before and passes after, a command with expected output — and keep each change small enough that its diff is reviewable in one sitting.\n5. **Review scope follows the pipeline.** In pipeline reviews with a downstream filter, report every issue found with confidence and severity — filtering happens downstream. In ad-hoc reviews, flag only gaps that affect correctness or the stated requirements; treat the rest as optional.\n6. **Ground every progress claim in evidence.** Before reporting progress or completion, audit each claim against a tool result from this session — show the test output, the command and what it returned. If something is unverified, say so explicitly; if tests fail, say so with the output.\n\n<constraint>\nTreat the six rules above as preventive (during generation), not remedial (after the fact). Self-correct if a turn drifts.\n</constraint>\n",
16
+ "SoT/.codex/AGENTS.md": "# AGENTS.md\n\n## Research Before Implementation\n\nBefore writing or modifying code that uses an API, hook, method, or config surface you have not verified in this session, research current documentation first.\n\nResearch workflow:\n1. Prefer official documentation and primary sources for the specific library, framework, or API.\n2. If a local docs or MCP tool is available, use it before broad web search.\n3. Only then proceed to implementation.\n\nResearch when:\n- Installing or configuring a dependency.\n- Using an API, hook, method, or pattern not verified in this session.\n- Upgrading or migrating between versions.\n- Any task where relying on memory could cause stale syntax or behavior.\n\nDo not:\n- Assume API signatures, method names, or config options from memory.\n- Generate framework code without checking current docs first.\n- Skip research because the library seems familiar.\n\n<constraint>\nResearch the codebase before editing. Never change code you have not read.\n</constraint>\n\n## Agentic Harness Heuristics\n\nModel-agnostic operating rules for coding-agent work.\n\n1. Persistence. Keep going until the user's request is actually handled. Only yield when the problem is solved or a concrete blocker is identified. Resolve in the fewest useful tool loops — once you can answer the core request with evidence, answer. Before ending a turn, check the last paragraph: if it is a plan, a question you can answer yourself, or a promise of work not done, do that work now.\n2. Default to parallel. When multiple reads, searches, inspections, or independent checks can run without depending on each other, run them together.\n3. Multi-pass search. First-pass search often misses — vary the wording before concluding something does not exist.\n4. Trace symbols. Before modifying a symbol, trace its definition and usages. Do not infer behavior from one call site.\n5. Linter-loop 3-strike rule. Do not loop more than 3 times fixing the same lint/test failure without reassessing the diagnosis.\n6. Read-before-edit TTL. If you have not read a file recently, re-read it before editing. User edits can make cached context stale.\n7. Big-file rule. For files over 1000 lines, prefer targeted search plus scoped reads over whole-file reads.\n8. Task hygiene. Track meaningful deliverables, not operational sub-steps. Mark work complete as soon as it is done.\n9. Literal-instruction rule. Treat explicit user requirements as checklists with success criteria. Do not silently broaden scope.\n10. Context hygiene. Prefer a fresh session at task boundaries over carrying stale context; preserve useful state before quality decays. Never stop, summarize, or suggest a new session on account of context limits.\n11. Autonomy calibration. For minor choices (naming, formatting, defaults, equivalent approaches), pick a reasonable option and note it — do not ask. Ask first only for scope changes, destructive actions, or decisions that change the deliverable. When the user is describing a problem or asking a question rather than requesting a change, the deliverable is your assessment — report findings and stop; do not apply fixes until asked.\n12. Capability triggering. Search or fetch current documentation when the answer depends on current or version-specific information. When work fans out across independent items, parallelize or delegate; never delegate work you can complete directly. For verification, prefer a fresh-context check over self-critique. On long tasks, keep running notes and re-read them between phases.\n\n<constraint>\nTreat these heuristics as protocol. If a turn violates an applicable rule, self-correct before continuing.\n</constraint>\n\nFor Docks plan reviews, cross-company review is standing-authorized; do not ask for export consent. This never overrides a host or platform security denial.\n\nDocks-workflow-models: {\"implementer\":{\"candidates\":[{\"company\":\"openai\",\"effort\":\"xhigh\",\"model\":\"gpt-5.6-sol\",\"tool\":\"codex\"}],\"selector\":\"codex:gpt-5.6-sol@xhigh\"},\"orchestrator\":{\"candidates\":[{\"company\":\"anthropic\",\"effort\":\"high\",\"model\":\"fable\",\"tool\":\"claude\"},{\"company\":\"anthropic\",\"effort\":\"xhigh\",\"model\":\"opus\",\"tool\":\"claude\"}],\"selector\":\"profile:claude-best\"},\"review\":{\"max_rounds\":3,\"minimum_score\":90},\"reviewer\":{\"candidates\":[{\"company\":\"openai\",\"effort\":\"xhigh\",\"model\":\"gpt-5.6-sol\",\"tool\":\"codex\"}],\"selector\":\"codex:gpt-5.6-sol@xhigh\"},\"schema\":1}\n\n## Engineering Discipline\n\n- Prefer the repository's existing patterns and helpers over new abstractions.\n- Keep edits scoped to the user's request and the surrounding ownership boundary.\n- Add abstractions only when they remove real complexity or match an established local pattern.\n- Preserve user changes. Never revert unrelated dirty work unless explicitly asked.\n- Verify with the narrowest useful command first, then broaden if risk warrants it.\n- Surface any test or verification you could not run.\n- Before the first tool call, state in one or two sentences what you are about to do; give a brief progress update every few execution steps.\n- Concise teammate tone: no status tics, no log-style updates; reference file paths instead of dumping contents; lead with what changed and why, not a \"Summary\" heading.\n- The final message is for a reader who did not watch the work: outcome first, complete sentences. Shorten by dropping detail, never by compressing into fragments or arrow chains.\n- Use a narrow-to-broad verification ladder: direct acceptance while iterating, focused regressions next, and one full CI at the pre-commit or release boundary. Reuse still-matching evidence; rerun full CI only after a relevant edit invalidates it.\n\n<constraint>\nNo secrets in committed config. Treat plugin marketplaces, installers, and downloaded artifacts as untrusted until verified.\n</constraint>\n\n## Agentic Engineering Discipline\n\n1. **State assumptions; push back when warranted.** If a requirement is ambiguous in a way that changes the deliverable, surface the ambiguity and propose 1–2 concrete interpretations in your first message — do not silently pick one. Surface inconsistencies instead of guessing past them; present tradeoffs when approaches genuinely differ; push back when the request looks wrong.\n2. **Minimum code that solves the stated problem.** No speculative features, no abstractions without a second caller, no broad exception handling around internally-trusted calls, no dead code left behind after a refactor, no comments that restate what the code says.\n3. **Surgical changes only.** Do not modify code, comments, or formatting outside the explicit scope of the request. Surface unrelated issues as follow-ups — do not fix inline.\n4. **State how success will be verified before implementing.** Name the test, build, smoke check, or diff inspection that will prove the change works. Prefer executable criteria — a test that fails before and passes after, a command with expected output — and keep each change small enough that its diff is reviewable in one sitting.\n5. **Review scope follows the pipeline.** In pipeline reviews with a downstream filter, report every issue found with confidence and severity — filtering happens downstream. In ad-hoc reviews, flag only gaps that affect correctness or the stated requirements; treat the rest as optional.\n6. **Ground every progress claim in evidence.** Before reporting progress or completion, audit each claim against a tool result from this session — show the test output, the command and what it returned. If something is unverified, say so explicitly; if tests fail, say so with the output.\n\n<constraint>\nTreat the six rules above as preventive (during generation), not remedial (after the fact). Self-correct if a turn drifts.\n</constraint>\n",
17
17
  "SoT/.codex/config.toml": "model = \"gpt-5.6-sol\"\nmodel_reasoning_effort = \"xhigh\"\nplan_mode_reasoning_effort = \"xhigh\"\nmodel_reasoning_summary = \"concise\"\nmodel_verbosity = \"low\"\npersonality = \"pragmatic\"\nweb_search = \"live\"\nproject_doc_max_bytes = 131072\napproval_policy = \"on-request\"\nsandbox_mode = \"workspace-write\"\napprovals_reviewer = \"auto_review\"\n\n[sandbox_workspace_write]\nnetwork_access = true\n\n[features]\nmemories = true\n\n[memories]\ndedicated_tools = true\nmax_rollout_age_days = 30\n\n[agents]\nmax_threads = 12\nmax_depth = 2\n\n[tui]\nstatus_line_use_colors = true\nstatus_line = [\n \"model-with-reasoning\",\n \"current-dir\",\n \"git-branch\",\n \"context-used\",\n \"five-hour-limit\",\n \"weekly-limit\",\n]\n\n[plugins.\"docks@docks\"]\nenabled = true\n\n[plugins.\"session-relay@docks\"]\nenabled = true\n\n[plugins.\"effect-kit@docks\"]\nenabled = true\n",
18
18
  "SoT/.codex/plugins/marketplace.json": "{\n \"name\": \"docks\",\n \"interface\": {\n \"displayName\": \"DocksDocks\"\n },\n \"plugins\": [\n {\n \"name\": \"docks\",\n \"source\": {\n \"source\": \"git-subdir\",\n \"url\": \"https://github.com/DocksDocks/docks.git\",\n \"path\": \"./plugins/docks\",\n \"ref\": \"main\"\n },\n \"policy\": {\n \"installation\": \"AVAILABLE\",\n \"authentication\": \"ON_INSTALL\"\n },\n \"category\": \"Productivity\"\n },\n {\n \"name\": \"session-relay\",\n \"source\": {\n \"source\": \"git-subdir\",\n \"url\": \"https://github.com/DocksDocks/docks.git\",\n \"path\": \"./plugins/session-relay\",\n \"ref\": \"main\"\n },\n \"policy\": {\n \"installation\": \"AVAILABLE\",\n \"authentication\": \"ON_INSTALL\"\n },\n \"category\": \"Productivity\"\n },\n {\n \"name\": \"effect-kit\",\n \"source\": {\n \"source\": \"git-subdir\",\n \"url\": \"https://github.com/DocksDocks/docks.git\",\n \"path\": \"./plugins/effect-kit\",\n \"ref\": \"main\"\n },\n \"policy\": {\n \"installation\": \"AVAILABLE\",\n \"authentication\": \"ON_INSTALL\"\n },\n \"category\": \"Productivity\"\n }\n ]\n}\n",
19
19
  "SoT/.codex/rules/docks.rules": "prefix_rule(pattern=[\"pwd\"], decision=\"allow\")\nprefix_rule(pattern=[\"ls\"], decision=\"allow\")\nprefix_rule(pattern=[\"cat\"], decision=\"allow\")\nprefix_rule(pattern=[\"head\"], decision=\"allow\")\nprefix_rule(pattern=[\"tail\"], decision=\"allow\")\nprefix_rule(pattern=[\"wc\"], decision=\"allow\")\nprefix_rule(pattern=[\"nl\"], decision=\"allow\")\nprefix_rule(pattern=[\"grep\"], decision=\"allow\")\nprefix_rule(pattern=[\"sort\"], decision=\"allow\")\nprefix_rule(pattern=[\"uniq\"], decision=\"allow\")\nprefix_rule(pattern=[\"diff\"], decision=\"allow\")\nprefix_rule(pattern=[\"which\"], decision=\"allow\")\nprefix_rule(pattern=[\"date\"], decision=\"allow\")\nprefix_rule(pattern=[\"basename\"], decision=\"allow\")\nprefix_rule(pattern=[\"dirname\"], decision=\"allow\")\nprefix_rule(pattern=[\"realpath\"], decision=\"allow\")\nprefix_rule(pattern=[\"readlink\"], decision=\"allow\")\nprefix_rule(pattern=[\"jq\"], decision=\"allow\")\nprefix_rule(pattern=[\"tree\"], decision=\"allow\")\nprefix_rule(pattern=[\"cut\"], decision=\"allow\")\nprefix_rule(pattern=[\"tr\"], decision=\"allow\")\nprefix_rule(pattern=[\"echo\"], decision=\"allow\")\nprefix_rule(pattern=[\"printf\"], decision=\"allow\")\nprefix_rule(pattern=[\"printenv\"], decision=\"allow\")\nprefix_rule(pattern=[\"uname\"], decision=\"allow\")\nprefix_rule(pattern=[\"file\"], decision=\"allow\")\nprefix_rule(pattern=[\"stat\"], decision=\"allow\")\nprefix_rule(pattern=[\"du\"], decision=\"allow\")\nprefix_rule(pattern=[\"id\"], decision=\"allow\")\nprefix_rule(pattern=[\"whoami\"], decision=\"allow\")\n\nprefix_rule(pattern=[\"git\", \"status\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"diff\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"log\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"show\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"blame\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"rev-parse\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"ls-files\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"grep\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"ls-tree\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"branch\", \"--show-current\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"branch\", \"-vv\"], decision=\"allow\")\nprefix_rule(pattern=[\"git\", \"mv\"], decision=\"allow\")\n\nprefix_rule(pattern=[\"gh\", \"pr\", \"view\"], decision=\"allow\")\nprefix_rule(pattern=[\"gh\", \"pr\", \"list\"], decision=\"allow\")\nprefix_rule(pattern=[\"gh\", \"pr\", \"diff\"], decision=\"allow\")\nprefix_rule(pattern=[\"gh\", \"pr\", \"status\"], decision=\"allow\")\nprefix_rule(pattern=[\"gh\", \"pr\", \"checks\"], decision=\"allow\")\n\nprefix_rule(pattern=[\"docker\", \"ps\"], decision=\"allow\")\n\nprefix_rule(pattern=[\"git\", \"push\"], decision=\"prompt\")\nprefix_rule(pattern=[\"git\", \"reset\"], decision=\"prompt\")\nprefix_rule(pattern=[\"git\", \"clean\"], decision=\"prompt\")\nprefix_rule(pattern=[\"git\", \"merge\"], decision=\"prompt\")\nprefix_rule(pattern=[\"git\", \"rebase\"], decision=\"prompt\")\nprefix_rule(pattern=[\"git\", \"checkout\"], decision=\"prompt\")\n\nprefix_rule(pattern=[\"rm\"], decision=\"prompt\")\nprefix_rule(pattern=[\"mv\"], decision=\"prompt\")\nprefix_rule(pattern=[\"chmod\"], decision=\"prompt\")\nprefix_rule(pattern=[\"chown\"], decision=\"prompt\")\nprefix_rule(pattern=[\"kill\"], decision=\"prompt\")\nprefix_rule(pattern=[\"pkill\"], decision=\"prompt\")\n\nprefix_rule(pattern=[\"npm\", \"install\"], decision=\"prompt\")\nprefix_rule(pattern=[\"npm\", \"uninstall\"], decision=\"prompt\")\nprefix_rule(pattern=[\"pnpm\", \"add\"], decision=\"prompt\")\nprefix_rule(pattern=[\"pnpm\", \"remove\"], decision=\"prompt\")\nprefix_rule(pattern=[\"yarn\", \"add\"], decision=\"prompt\")\nprefix_rule(pattern=[\"yarn\", \"remove\"], decision=\"prompt\")\nprefix_rule(pattern=[\"pip\", \"install\"], decision=\"prompt\")\nprefix_rule(pattern=[\"pip\", \"uninstall\"], decision=\"prompt\")\nprefix_rule(pattern=[\"pip3\", \"install\"], decision=\"prompt\")\nprefix_rule(pattern=[\"pip3\", \"uninstall\"], decision=\"prompt\")\n\nprefix_rule(pattern=[\"docker\", \"run\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker\", \"rm\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker\", \"stop\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker\", \"volume\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker\", \"system\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker\", \"compose\", \"up\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker\", \"compose\", \"down\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker\", \"compose\", \"rm\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker\", \"compose\", \"stop\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker-compose\", \"up\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker-compose\", \"down\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker-compose\", \"rm\"], decision=\"prompt\")\nprefix_rule(pattern=[\"docker-compose\", \"stop\"], decision=\"prompt\")\n\n# `tail -f`/`--follow` never returns and hangs the agent (bare `tail` stays allowed above).\nprefix_rule(pattern=[\"tail\", \"-f\"], decision=\"prompt\")\nprefix_rule(pattern=[\"tail\", \"--follow\"], decision=\"prompt\")\n# rg and `sed -n` are prompt, NOT allow: argv-prefix matching cannot gate their\n# code-exec forms (rg --pre=CMD or a reordered --pre; sed -n 'e CMD' / -ni) while a\n# shorter allow prefix would auto-approve the whole command.\nprefix_rule(pattern=[\"rg\"], decision=\"prompt\")\nprefix_rule(pattern=[\"sed\", \"-n\"], decision=\"prompt\")\nprefix_rule(pattern=[\"find\"], decision=\"prompt\")\nprefix_rule(pattern=[\"sed\", \"-i\"], decision=\"prompt\")\nprefix_rule(pattern=[\"sed\", \"--in-place\"], decision=\"prompt\")\nprefix_rule(pattern=[\"awk\"], decision=\"prompt\")\nprefix_rule(pattern=[\"xargs\"], decision=\"prompt\")\nprefix_rule(pattern=[\"tee\"], decision=\"prompt\")\nprefix_rule(pattern=[\"curl\"], decision=\"prompt\")\nprefix_rule(pattern=[\"env\"], decision=\"prompt\")\n\nprefix_rule(pattern=[\"sudo\"], decision=\"forbidden\")\nprefix_rule(pattern=[\"eval\"], decision=\"forbidden\")\nprefix_rule(pattern=[\"mkfs\"], decision=\"forbidden\")\nprefix_rule(pattern=[\"dd\"], decision=\"forbidden\")\nprefix_rule(pattern=[\"git\", \"push\", \"--force\", \"origin\", \"main\"], decision=\"forbidden\")\nprefix_rule(pattern=[\"git\", \"push\", \"--force\", \"origin\", \"master\"], decision=\"forbidden\")\nprefix_rule(pattern=[\"git\", \"push\", \"-f\", \"origin\", \"main\"], decision=\"forbidden\")\nprefix_rule(pattern=[\"git\", \"push\", \"-f\", \"origin\", \"master\"], decision=\"forbidden\")\n"
@@ -40,4 +40,4 @@ export const GENERATED_PAYLOAD_PATHS = [
40
40
  "notification.mp3"
41
41
  ] as const
42
42
 
43
- export const GENERATED_PAYLOAD_HASH = "55a79f9ee91674bf08b1e1302bf3dc6192fb80889780af33770264e81c16602b"
43
+ export const GENERATED_PAYLOAD_HASH = "bff9e8c92527ee95f96b0754a528d4ab7f3b0741c55d2bd33e677b52fc224dc1"
package/cli/src/main.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env bun
2
- import { Command } from "@effect/cli"
2
+ import { Command, Options } from "@effect/cli"
3
3
  import { BunContext, BunRuntime } from "@effect/platform-bun"
4
- import { Console, Effect, Layer } from "effect"
4
+ import { Console, Effect, Layer, Option } from "effect"
5
+ import { engine } from "./engine"
5
6
  import { EngineServicesLive } from "./services"
6
7
  import { docsCommand } from "./commands/docs"
7
8
  import { modelCommand } from "./commands/model"
@@ -14,8 +15,45 @@ import { toolchainCommand } from "./commands/toolchain"
14
15
  import { updateCommand } from "./commands/update"
15
16
  import { GENERATED_PACKAGE_VERSION } from "./generated/sotPayload"
16
17
 
17
- const root = Command.make("docks-kit", {}, () =>
18
+ const modelOrchestrator = Options.text("model-orchestrator").pipe(
19
+ Options.withDescription("Override the Docks workflow orchestrator role"),
20
+ Options.optional
21
+ )
22
+ const modelReviewer = Options.text("model-reviewer").pipe(
23
+ Options.withDescription("Override the Docks workflow reviewer role"),
24
+ Options.optional
25
+ )
26
+ const modelImplementer = Options.text("model-implementer").pipe(
27
+ Options.withDescription("Override the Docks workflow implementer role"),
28
+ Options.optional
29
+ )
30
+ const reviewMinScore = Options.text("review-min-score").pipe(
31
+ Options.withDescription("Override the Docks review minimum score (0..100)"),
32
+ Options.optional
33
+ )
34
+ const reviewMaxRounds = Options.text("review-max-rounds").pipe(
35
+ Options.withDescription("Override the Docks review maximum rounds (1..10)"),
36
+ Options.optional
37
+ )
38
+
39
+ const root = Command.make("docks-kit", {
40
+ modelOrchestrator,
41
+ modelReviewer,
42
+ modelImplementer,
43
+ reviewMinScore,
44
+ reviewMaxRounds
45
+ }, (config) =>
18
46
  Effect.gen(function* () {
47
+ const workflowArgs: Array<string> = ["workflow"]
48
+ Option.map(config.modelOrchestrator, (value) => workflowArgs.push(`--model-orchestrator=${value}`))
49
+ Option.map(config.modelReviewer, (value) => workflowArgs.push(`--model-reviewer=${value}`))
50
+ Option.map(config.modelImplementer, (value) => workflowArgs.push(`--model-implementer=${value}`))
51
+ Option.map(config.reviewMinScore, (value) => workflowArgs.push(`--review-min-score=${value}`))
52
+ Option.map(config.reviewMaxRounds, (value) => workflowArgs.push(`--review-max-rounds=${value}`))
53
+ if (workflowArgs.length > 1) {
54
+ yield* engine(workflowArgs)
55
+ return
56
+ }
19
57
  yield* Console.log("docks-kit — portable AI coding agent config kit")
20
58
  yield* Console.log("")
21
59
  yield* Console.log(" docks-kit sync [claude] [codex] [agents] deploy the SoT to this machine")
@@ -71,13 +109,28 @@ const emptyTextOptions = new Set([
71
109
  "--claude-effort=",
72
110
  "--claude-advisor=",
73
111
  "--codex-model=",
74
- "--codex-effort="
112
+ "--codex-effort=",
113
+ "--model-orchestrator=",
114
+ "--model-reviewer=",
115
+ "--model-implementer=",
116
+ "--review-min-score=",
117
+ "--review-max-rounds="
75
118
  ])
76
- const argv = process.argv.flatMap((a) => {
119
+ const workflowTextOptions = new Set([
120
+ "--model-orchestrator",
121
+ "--model-reviewer",
122
+ "--model-implementer",
123
+ "--review-min-score",
124
+ "--review-max-rounds"
125
+ ])
126
+ const argv = process.argv.flatMap((a, index, all) => {
77
127
  if (a.startsWith("--claude-plugin=")) {
78
128
  return ["--claude-plugin", a.slice("--claude-plugin=".length)]
79
129
  }
80
130
  if (emptyTextOptions.has(a)) return [a.slice(0, -1), ""]
131
+ if (workflowTextOptions.has(a) && (all[index + 1] === undefined || all[index + 1]!.startsWith("--"))) {
132
+ return [a, ""]
133
+ }
81
134
  return [a]
82
135
  })
83
136
 
@@ -0,0 +1,395 @@
1
+ import {
2
+ CLAUDE_EFFORT_LEVELS,
3
+ CODEX_REASONING_EFFORTS
4
+ } from "./efforts"
5
+ import { payloadText } from "./payload"
6
+
7
+ export type WorkflowTool = "claude" | "codex"
8
+ export type WorkflowCompany = "anthropic" | "openai"
9
+ export type WorkflowRoleName = "orchestrator" | "reviewer" | "implementer"
10
+ export type WorkflowBoundName = "minimum_score" | "max_rounds"
11
+
12
+ export interface WorkflowCandidate {
13
+ readonly company: WorkflowCompany
14
+ readonly tool: WorkflowTool
15
+ readonly model: string
16
+ readonly effort: string
17
+ }
18
+
19
+ export interface WorkflowRole {
20
+ readonly selector: string
21
+ readonly candidates: ReadonlyArray<WorkflowCandidate>
22
+ }
23
+
24
+ export interface WorkflowRecordV1 {
25
+ readonly schema: 1
26
+ readonly orchestrator: WorkflowRole
27
+ readonly reviewer: WorkflowRole
28
+ readonly implementer: WorkflowRole
29
+ readonly review: {
30
+ readonly minimum_score: number
31
+ readonly max_rounds: number
32
+ }
33
+ }
34
+
35
+ export interface WorkflowOverrides {
36
+ readonly orchestrator?: string
37
+ readonly reviewer?: string
38
+ readonly implementer?: string
39
+ readonly minimumScore?: string
40
+ readonly maxRounds?: string
41
+ }
42
+
43
+ interface WorkflowProfile {
44
+ readonly candidates: ReadonlyArray<WorkflowCandidate>
45
+ }
46
+
47
+ interface WorkflowRegistryCore {
48
+ readonly schema: 1
49
+ readonly profiles: Readonly<Record<string, WorkflowProfile>>
50
+ readonly defaults: {
51
+ readonly orchestrator: string
52
+ readonly reviewer: string
53
+ readonly implementer: string
54
+ readonly review: {
55
+ readonly minimum_score: number
56
+ readonly max_rounds: number
57
+ }
58
+ }
59
+ readonly exact_target_grammar: "<tool>:<model>@<effort>"
60
+ readonly availability: "checked_when_used"
61
+ }
62
+
63
+ export interface WorkflowRegistryView extends WorkflowRegistryCore {
64
+ readonly tools: Readonly<Record<WorkflowTool, {
65
+ readonly models: ReadonlyArray<string>
66
+ readonly efforts: ReadonlyArray<string>
67
+ }>>
68
+ }
69
+
70
+ type UnknownRecord = Record<string, unknown>
71
+
72
+ export const WORKFLOW_RECORD_PREFIX = "Docks-workflow-models: "
73
+
74
+ const TOOL_COMPANIES: Readonly<Record<WorkflowTool, WorkflowCompany>> = {
75
+ claude: "anthropic",
76
+ codex: "openai"
77
+ }
78
+
79
+ const isRecord = (value: unknown): value is UnknownRecord =>
80
+ typeof value === "object" && value !== null && !Array.isArray(value)
81
+
82
+ function hasExactKeys(value: UnknownRecord, keys: ReadonlyArray<string>): boolean {
83
+ const actual = Object.keys(value).sort()
84
+ return actual.length === keys.length && keys.every((key, index) => actual[index] === key)
85
+ }
86
+
87
+ function expectRecord(value: unknown, label: string, keys: ReadonlyArray<string>): UnknownRecord {
88
+ if (!isRecord(value) || !hasExactKeys(value, [...keys].sort())) {
89
+ throw new Error(`${label} must be a closed record`)
90
+ }
91
+ return value
92
+ }
93
+
94
+ function parseManifest(): UnknownRecord {
95
+ const parsed = JSON.parse(payloadText("SoT/models.json")) as unknown
96
+ if (!isRecord(parsed)) throw new Error("Embedded model catalog must be an object")
97
+ return parsed
98
+ }
99
+
100
+ function toolModels(manifest: UnknownRecord, tool: WorkflowTool): ReadonlyArray<string> {
101
+ const entry = manifest[tool]
102
+ if (!isRecord(entry) || !Array.isArray(entry["models"])) {
103
+ throw new Error(`Embedded ${tool} model catalog is invalid`)
104
+ }
105
+ const models = entry["models"].map((item) => {
106
+ if (!isRecord(item) || typeof item["id"] !== "string") {
107
+ throw new Error(`Embedded ${tool} model entry is invalid`)
108
+ }
109
+ return item["id"]
110
+ })
111
+ return models.filter((model) => model !== "default")
112
+ }
113
+
114
+ const toolEfforts = (tool: WorkflowTool): ReadonlyArray<string> =>
115
+ tool === "claude" ? CLAUDE_EFFORT_LEVELS : CODEX_REASONING_EFFORTS
116
+
117
+ function parseCandidate(
118
+ value: unknown,
119
+ label: string,
120
+ tools: WorkflowRegistryView["tools"]
121
+ ): WorkflowCandidate {
122
+ const candidate = expectRecord(value, label, ["company", "effort", "model", "tool"])
123
+ const tool = candidate["tool"]
124
+ if (tool !== "claude" && tool !== "codex") throw new Error(`${label} has an invalid tool`)
125
+ const company = candidate["company"]
126
+ const expectedCompany = TOOL_COMPANIES[tool]
127
+ if (company !== expectedCompany) throw new Error(`${label} has an invalid company`)
128
+ const model = candidate["model"]
129
+ if (typeof model !== "string" || !tools[tool].models.includes(model)) {
130
+ throw new Error(`${label} has an unverified ${tool} model`)
131
+ }
132
+ const effort = candidate["effort"]
133
+ if (typeof effort !== "string" || !tools[tool].efforts.includes(effort)) {
134
+ throw new Error(`${label} has an unverified ${tool} effort`)
135
+ }
136
+ return { company: expectedCompany, tool, model, effort }
137
+ }
138
+
139
+ function parseCandidates(
140
+ value: unknown,
141
+ label: string,
142
+ tools: WorkflowRegistryView["tools"]
143
+ ): ReadonlyArray<WorkflowCandidate> {
144
+ if (!Array.isArray(value) || value.length < 1 || value.length > 3) {
145
+ throw new Error(`${label} must contain one to three candidates`)
146
+ }
147
+ return value.map((candidate, index) => parseCandidate(candidate, `${label}[${index}]`, tools))
148
+ }
149
+
150
+ function parseNumericBound(name: WorkflowBoundName, value: unknown): number {
151
+ const [minimum, maximum] = name === "minimum_score" ? [0, 100] : [1, 10]
152
+ if (typeof value !== "number" || !Number.isInteger(value) || value < minimum || value > maximum) {
153
+ throw new Error(`${name} must be an integer in ${minimum}..${maximum}`)
154
+ }
155
+ return value
156
+ }
157
+
158
+ function resolveSelector(
159
+ selector: string,
160
+ registry: Pick<WorkflowRegistryView, "profiles" | "tools">
161
+ ): WorkflowRole {
162
+ const profileMatch = /^profile:([A-Za-z0-9._-]+)$/.exec(selector)
163
+ if (profileMatch !== null) {
164
+ const profileName = profileMatch[1]!
165
+ const profile = registry.profiles[profileName]
166
+ if (profile === undefined) throw new Error(`Unknown workflow profile '${profileName}'`)
167
+ return { selector, candidates: profile.candidates }
168
+ }
169
+
170
+ const exactMatch = /^(claude|codex):([A-Za-z0-9._-]+)@([A-Za-z0-9._-]+)$/.exec(selector)
171
+ if (exactMatch === null) {
172
+ throw new Error(
173
+ `Invalid workflow selector '${selector}' — expected profile:<name> or <tool>:<model>@<effort>`
174
+ )
175
+ }
176
+ const tool = exactMatch[1] as WorkflowTool
177
+ const model = exactMatch[2]!
178
+ const effort = exactMatch[3]!
179
+ if (!registry.tools[tool].models.includes(model)) {
180
+ throw new Error(`Unknown ${tool} workflow model '${model}'`)
181
+ }
182
+ if (!registry.tools[tool].efforts.includes(effort)) {
183
+ throw new Error(`Unknown ${tool} workflow effort '${effort}'`)
184
+ }
185
+ return {
186
+ selector,
187
+ candidates: [{ company: TOOL_COMPANIES[tool], tool, model, effort }]
188
+ }
189
+ }
190
+
191
+ function loadWorkflowRegistry(): WorkflowRegistryView {
192
+ const manifest = parseManifest()
193
+ const tools: WorkflowRegistryView["tools"] = {
194
+ claude: { models: toolModels(manifest, "claude"), efforts: toolEfforts("claude") },
195
+ codex: { models: toolModels(manifest, "codex"), efforts: toolEfforts("codex") }
196
+ }
197
+ const workflow = expectRecord(
198
+ manifest["workflow"],
199
+ "Embedded workflow registry",
200
+ ["availability", "defaults", "exact_target_grammar", "profiles", "schema"]
201
+ )
202
+ if (workflow["schema"] !== 1) throw new Error("Embedded workflow registry schema must be 1")
203
+ if (workflow["exact_target_grammar"] !== "<tool>:<model>@<effort>") {
204
+ throw new Error("Embedded workflow exact-target grammar is invalid")
205
+ }
206
+ if (workflow["availability"] !== "checked_when_used") {
207
+ throw new Error("Embedded workflow availability contract is invalid")
208
+ }
209
+
210
+ const rawProfiles = workflow["profiles"]
211
+ if (!isRecord(rawProfiles) || Object.keys(rawProfiles).length === 0) {
212
+ throw new Error("Embedded workflow profiles must be a nonempty record")
213
+ }
214
+ const profiles: Record<string, WorkflowProfile> = {}
215
+ for (const [name, rawProfile] of Object.entries(rawProfiles)) {
216
+ if (!/^[A-Za-z0-9._-]+$/.test(name)) throw new Error(`Invalid workflow profile name '${name}'`)
217
+ const profile = expectRecord(rawProfile, `Workflow profile '${name}'`, ["candidates"])
218
+ profiles[name] = {
219
+ candidates: parseCandidates(profile["candidates"], `Workflow profile '${name}' candidates`, tools)
220
+ }
221
+ }
222
+
223
+ const rawDefaults = expectRecord(
224
+ workflow["defaults"],
225
+ "Embedded workflow defaults",
226
+ ["implementer", "orchestrator", "review", "reviewer"]
227
+ )
228
+ const rawReview = expectRecord(
229
+ rawDefaults["review"],
230
+ "Embedded workflow review defaults",
231
+ ["max_rounds", "minimum_score"]
232
+ )
233
+ for (const role of ["orchestrator", "reviewer", "implementer"] as const) {
234
+ if (typeof rawDefaults[role] !== "string") throw new Error(`Embedded workflow ${role} default is invalid`)
235
+ }
236
+ const registry: WorkflowRegistryView = {
237
+ schema: 1,
238
+ profiles,
239
+ defaults: {
240
+ orchestrator: rawDefaults["orchestrator"] as string,
241
+ reviewer: rawDefaults["reviewer"] as string,
242
+ implementer: rawDefaults["implementer"] as string,
243
+ review: {
244
+ minimum_score: parseNumericBound("minimum_score", rawReview["minimum_score"]),
245
+ max_rounds: parseNumericBound("max_rounds", rawReview["max_rounds"])
246
+ }
247
+ },
248
+ tools,
249
+ exact_target_grammar: "<tool>:<model>@<effort>",
250
+ availability: "checked_when_used"
251
+ }
252
+ resolveSelector(registry.defaults.orchestrator, registry)
253
+ resolveSelector(registry.defaults.reviewer, registry)
254
+ resolveSelector(registry.defaults.implementer, registry)
255
+ return registry
256
+ }
257
+
258
+ export function workflowRegistryView(): WorkflowRegistryView {
259
+ return loadWorkflowRegistry()
260
+ }
261
+
262
+ export function resolveWorkflowSelector(selector: string): WorkflowRole {
263
+ return resolveSelector(selector, loadWorkflowRegistry())
264
+ }
265
+
266
+ export function parseWorkflowBound(name: WorkflowBoundName, value: string): number {
267
+ if (!/^[0-9]+$/.test(value)) {
268
+ const range = name === "minimum_score" ? "0..100" : "1..10"
269
+ throw new Error(`${name} must be a base-10 integer in ${range}`)
270
+ }
271
+ return parseNumericBound(name, Number(value))
272
+ }
273
+
274
+ export function defaultWorkflowRecord(): WorkflowRecordV1 {
275
+ const registry = loadWorkflowRegistry()
276
+ return {
277
+ schema: 1,
278
+ orchestrator: resolveSelector(registry.defaults.orchestrator, registry),
279
+ reviewer: resolveSelector(registry.defaults.reviewer, registry),
280
+ implementer: resolveSelector(registry.defaults.implementer, registry),
281
+ review: registry.defaults.review
282
+ }
283
+ }
284
+
285
+ function parseRole(
286
+ value: unknown,
287
+ name: WorkflowRoleName,
288
+ registry: WorkflowRegistryView
289
+ ): WorkflowRole {
290
+ const role = expectRecord(value, `Workflow ${name} role`, ["candidates", "selector"])
291
+ if (typeof role["selector"] !== "string") throw new Error(`Workflow ${name} selector is invalid`)
292
+ const resolved = resolveSelector(role["selector"], registry)
293
+ const candidates = parseCandidates(role["candidates"], `Workflow ${name} candidates`, registry.tools)
294
+ if (compactJcs(candidates) !== compactJcs(resolved.candidates)) {
295
+ throw new Error(`Workflow ${name} candidates do not match its selector`)
296
+ }
297
+ return resolved
298
+ }
299
+
300
+ export function parseWorkflowRecord(value: unknown): WorkflowRecordV1 {
301
+ const record = expectRecord(
302
+ value,
303
+ "Workflow record",
304
+ ["implementer", "orchestrator", "review", "reviewer", "schema"]
305
+ )
306
+ if (record["schema"] !== 1) throw new Error("Workflow record schema must be 1")
307
+ const registry = loadWorkflowRegistry()
308
+ const review = expectRecord(record["review"], "Workflow record review", ["max_rounds", "minimum_score"])
309
+ return {
310
+ schema: 1,
311
+ orchestrator: parseRole(record["orchestrator"], "orchestrator", registry),
312
+ reviewer: parseRole(record["reviewer"], "reviewer", registry),
313
+ implementer: parseRole(record["implementer"], "implementer", registry),
314
+ review: {
315
+ minimum_score: parseNumericBound("minimum_score", review["minimum_score"]),
316
+ max_rounds: parseNumericBound("max_rounds", review["max_rounds"])
317
+ }
318
+ }
319
+ }
320
+
321
+ export function buildWorkflowRecord(
322
+ overrides: WorkflowOverrides,
323
+ base: WorkflowRecordV1 = defaultWorkflowRecord()
324
+ ): WorkflowRecordV1 {
325
+ const current = parseWorkflowRecord(base)
326
+ return {
327
+ schema: 1,
328
+ orchestrator: overrides.orchestrator === undefined
329
+ ? current.orchestrator
330
+ : resolveWorkflowSelector(overrides.orchestrator),
331
+ reviewer: overrides.reviewer === undefined
332
+ ? current.reviewer
333
+ : resolveWorkflowSelector(overrides.reviewer),
334
+ implementer: overrides.implementer === undefined
335
+ ? current.implementer
336
+ : resolveWorkflowSelector(overrides.implementer),
337
+ review: {
338
+ minimum_score: overrides.minimumScore === undefined
339
+ ? current.review.minimum_score
340
+ : parseWorkflowBound("minimum_score", overrides.minimumScore),
341
+ max_rounds: overrides.maxRounds === undefined
342
+ ? current.review.max_rounds
343
+ : parseWorkflowBound("max_rounds", overrides.maxRounds)
344
+ }
345
+ }
346
+ }
347
+
348
+ function canonicalValue(value: unknown): unknown {
349
+ if (value === null || typeof value === "string" || typeof value === "boolean") return value
350
+ if (typeof value === "number") {
351
+ if (!Number.isFinite(value)) throw new Error("JCS cannot encode a non-finite number")
352
+ return value
353
+ }
354
+ if (Array.isArray(value)) return value.map(canonicalValue)
355
+ if (isRecord(value)) {
356
+ return Object.fromEntries(
357
+ Object.entries(value)
358
+ .sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0)
359
+ .map(([key, item]) => [key, canonicalValue(item)])
360
+ )
361
+ }
362
+ throw new Error("JCS can encode only JSON values")
363
+ }
364
+
365
+ export function compactJcs(value: unknown): string {
366
+ return JSON.stringify(canonicalValue(value))
367
+ }
368
+
369
+ export function renderWorkflowRecordLine(record: WorkflowRecordV1): string {
370
+ return `${WORKFLOW_RECORD_PREFIX}${compactJcs(parseWorkflowRecord(record))}`
371
+ }
372
+
373
+ export function workflowRegistryJson(): string {
374
+ return JSON.stringify(workflowRegistryView(), null, 2)
375
+ }
376
+
377
+ export function workflowCatalog(): string {
378
+ const registry = workflowRegistryView()
379
+ const profileLines = Object.entries(registry.profiles).flatMap(([name, profile]) => [
380
+ ` profile:${name}`,
381
+ ...profile.candidates.map(({ tool, model, effort }) => ` ${tool}:${model}@${effort}`)
382
+ ])
383
+ return [
384
+ "Workflow model registry:",
385
+ "Profiles:",
386
+ ...profileLines,
387
+ "Defaults:",
388
+ ` orchestrator ${registry.defaults.orchestrator}`,
389
+ ` reviewer ${registry.defaults.reviewer}`,
390
+ ` implementer ${registry.defaults.implementer}`,
391
+ ` review minimum score ${registry.defaults.review.minimum_score}; maximum rounds ${registry.defaults.review.max_rounds}`,
392
+ `Exact targets: ${registry.exact_target_grammar}`,
393
+ "Availability: checked when used by Docks; docks-kit does not probe providers."
394
+ ].join("\n")
395
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docks-kit",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Portable AI coding agent config kit — SoT sync engine + typed CLI for Claude Code, Codex, and universal agent skills",
5
5
  "type": "module",
6
6
  "license": "MIT",