sneakoscope 7.3.0 → 7.5.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.
Files changed (151) hide show
  1. package/README.md +117 -5
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/dist/cli/codex-app-command.js +1 -1
  5. package/dist/cli/command-manifest-lite.js +2 -1
  6. package/dist/cli/install-helpers-codex-lb-selftest.js +2 -1
  7. package/dist/cli/install-helpers-install-support.js +6 -16
  8. package/dist/cli/install-helpers.js +59 -50
  9. package/dist/cli/router.js +9 -1
  10. package/dist/config/skills-manifest.json +50 -71
  11. package/dist/core/codex-app.js +5 -5
  12. package/dist/core/codex-native/core-skill-manifest.js +9 -6
  13. package/dist/core/commands/image-ux-review-command.js +243 -50
  14. package/dist/core/commands/naruto-command.js +245 -8
  15. package/dist/core/commands/ppt-command.js +2 -2
  16. package/dist/core/commands/telegram-command.js +123 -10
  17. package/dist/core/commands/triwiki-command.js +11 -1
  18. package/dist/core/commands/triwiki-graph-command.js +160 -0
  19. package/dist/core/commands/wiki-command.js +100 -20
  20. package/dist/core/errors/message.js +3 -0
  21. package/dist/core/feature-registry.js +2 -2
  22. package/dist/core/fsx.js +7 -3
  23. package/dist/core/hooks-runtime/codex-commit-hooks-selftest.js +82 -0
  24. package/dist/core/hooks-runtime/context-graph-freshness-preflight.js +113 -0
  25. package/dist/core/hooks-runtime/official-subagent-lifecycle.js +1 -1
  26. package/dist/core/hooks-runtime/tool-output-quarantine.js +1 -1
  27. package/dist/core/hooks-runtime.js +28 -86
  28. package/dist/core/image-ux-review/callout-extraction.js +6 -0
  29. package/dist/core/image-ux-review/imagegen-adapter.js +54 -18
  30. package/dist/core/image-ux-review/real-callout-extractor.js +1 -0
  31. package/dist/core/image-ux-review.js +182 -7
  32. package/dist/core/imagegen/codex-lb-imagegen-target.js +22 -7
  33. package/dist/core/imagegen/imagegen-capability.js +11 -4
  34. package/dist/core/imagegen/require-imagegen.js +29 -5
  35. package/dist/core/init/skills.js +22 -10
  36. package/dist/core/install/installed-package-smoke.js +157 -4
  37. package/dist/core/managed-path-safety.js +8 -10
  38. package/dist/core/mcp-config/backup.js +2 -4
  39. package/dist/core/mcp-config/config-reader.js +2 -4
  40. package/dist/core/mcp-config/scope.js +3 -5
  41. package/dist/core/naruto/context-graph-advisor-scope.js +242 -0
  42. package/dist/core/naruto/context-graph-advisor.js +0 -0
  43. package/dist/core/pipeline-internals/runtime-core.js +44 -0
  44. package/dist/core/policy/latest-version-guidance.js +113 -0
  45. package/dist/core/ppt.js +8 -8
  46. package/dist/core/release/gate-manifest.js +32 -1
  47. package/dist/core/release/npm-stage-contract.js +21 -0
  48. package/dist/core/release/package-size-budget.js +2 -2
  49. package/dist/core/release/release-gate-contract.js +5 -0
  50. package/dist/core/release/stage-publish.js +27 -0
  51. package/dist/core/responses-stream.js +65 -19
  52. package/dist/core/routes/design-policy.js +7 -2
  53. package/dist/core/routes/dollar-manifest-lite.js +0 -4
  54. package/dist/core/routes/evidence.js +1 -1
  55. package/dist/core/routes.js +12 -8
  56. package/dist/core/safety/command-contract/contracts.js +2 -0
  57. package/dist/core/safety/command-contract/types.js +1 -1
  58. package/dist/core/search/context-graph-seeds.js +205 -0
  59. package/dist/core/search/context.js +0 -0
  60. package/dist/core/search/provider.js +2 -2
  61. package/dist/core/subagents/naruto-help-contract.js +2 -1
  62. package/dist/core/subagents/naruto-host-credentials.js +161 -0
  63. package/dist/core/subagents/official-subagent-preparation.js +4 -1
  64. package/dist/core/subagents/official-subagent-prompt.js +44 -2
  65. package/dist/core/subagents/official-subagent-runner.js +26 -8
  66. package/dist/core/subagents/triwiki-attention.js +135 -123
  67. package/dist/core/telegram/bot-api.js +59 -4
  68. package/dist/core/telegram/config.js +3 -2
  69. package/dist/core/telegram/hub.js +3 -2
  70. package/dist/core/telegram/owner-lock.js +4 -6
  71. package/dist/core/telegram/setup.js +223 -73
  72. package/dist/core/triwiki/code-pack.js +12 -120
  73. package/dist/core/triwiki/context-graph/compiler/cache-key.js +277 -0
  74. package/dist/core/triwiki/context-graph/compiler/extract.js +104 -0
  75. package/dist/core/triwiki/context-graph/compiler/freshness.js +108 -0
  76. package/dist/core/triwiki/context-graph/compiler/index.js +237 -0
  77. package/dist/core/triwiki/context-graph/compiler/merge.js +0 -0
  78. package/dist/core/triwiki/context-graph/compiler/serialize.js +115 -0
  79. package/dist/core/triwiki/context-graph/contracts.js +236 -0
  80. package/dist/core/triwiki/context-graph/extractors/code/builders.js +150 -0
  81. package/dist/core/triwiki/context-graph/extractors/code/declarations.js +161 -0
  82. package/dist/core/triwiki/context-graph/extractors/code/index.js +265 -0
  83. package/dist/core/triwiki/context-graph/extractors/code/inventory.js +237 -0
  84. package/dist/core/triwiki/context-graph/extractors/code/module-graph.js +252 -0
  85. package/dist/core/triwiki/context-graph/extractors/code/modules.js +79 -0
  86. package/dist/core/triwiki/context-graph/extractors/code/references.js +184 -0
  87. package/dist/core/triwiki/context-graph/extractors/code/selection.js +100 -0
  88. package/dist/core/triwiki/context-graph/extractors/code/ts-config.js +161 -0
  89. package/dist/core/triwiki/context-graph/extractors/code/types.js +18 -0
  90. package/dist/core/triwiki/context-graph/extractors/evidence/claims.js +289 -0
  91. package/dist/core/triwiki/context-graph/extractors/evidence/index.js +54 -0
  92. package/dist/core/triwiki/context-graph/extractors/evidence/proof-index.js +213 -0
  93. package/dist/core/triwiki/context-graph/extractors/evidence/proofs.js +266 -0
  94. package/dist/core/triwiki/context-graph/extractors/evidence/redaction.js +177 -0
  95. package/dist/core/triwiki/context-graph/extractors/evidence/shared.js +0 -0
  96. package/dist/core/triwiki/context-graph/extractors/evidence/sources.js +154 -0
  97. package/dist/core/triwiki/context-graph/extractors/index.js +7 -0
  98. package/dist/core/triwiki/context-graph/extractors/topology/commands.js +207 -0
  99. package/dist/core/triwiki/context-graph/extractors/topology/gate-edges.js +201 -0
  100. package/dist/core/triwiki/context-graph/extractors/topology/gates.js +182 -0
  101. package/dist/core/triwiki/context-graph/extractors/topology/globs.js +124 -0
  102. package/dist/core/triwiki/context-graph/extractors/topology/index.js +92 -0
  103. package/dist/core/triwiki/context-graph/extractors/topology/routes.js +135 -0
  104. package/dist/core/triwiki/context-graph/extractors/topology/shared.js +215 -0
  105. package/dist/core/triwiki/context-graph/graph-index.js +143 -0
  106. package/dist/core/triwiki/context-graph/ids.js +0 -0
  107. package/dist/core/triwiki/context-graph/lint/index.js +0 -0
  108. package/dist/core/triwiki/context-graph/lint/rules.js +232 -0
  109. package/dist/core/triwiki/context-graph/lint/warnings.js +93 -0
  110. package/dist/core/triwiki/context-graph/paths.js +116 -0
  111. package/dist/core/triwiki/context-graph/profiles.js +78 -0
  112. package/dist/core/triwiki/context-graph/projections/anchors.js +91 -0
  113. package/dist/core/triwiki/context-graph/projections/attention.js +58 -0
  114. package/dist/core/triwiki/context-graph/projections/code-pack-workspace.js +62 -0
  115. package/dist/core/triwiki/context-graph/projections/code-pack.js +144 -0
  116. package/dist/core/triwiki/context-graph/projections/index.js +7 -0
  117. package/dist/core/triwiki/context-graph/projections/module-view.js +140 -0
  118. package/dist/core/triwiki/context-graph/projections/node-summary.js +118 -0
  119. package/dist/core/triwiki/context-graph/projections/pack-contract.js +6 -0
  120. package/dist/core/triwiki/context-graph/query/explain.js +0 -0
  121. package/dist/core/triwiki/context-graph/query/index.js +178 -0
  122. package/dist/core/triwiki/context-graph/query/load.js +116 -0
  123. package/dist/core/triwiki/context-graph/query/pack.js +117 -0
  124. package/dist/core/triwiki/context-graph/query/rank.js +142 -0
  125. package/dist/core/triwiki/context-graph/query/ranking-config.js +64 -0
  126. package/dist/core/triwiki/context-graph/query/seeds.js +241 -0
  127. package/dist/core/triwiki/context-graph/query/snapshot-cache.js +72 -0
  128. package/dist/core/triwiki/context-graph/query/traverse.js +154 -0
  129. package/dist/core/triwiki/context-graph/query-types.js +29 -0
  130. package/dist/core/triwiki/context-graph/store/compile-lock.js +21 -0
  131. package/dist/core/triwiki/context-graph/store/event-log.js +48 -0
  132. package/dist/core/triwiki/context-graph/store/fragment-cache.js +85 -0
  133. package/dist/core/triwiki/context-graph/store/graph-status.js +85 -0
  134. package/dist/core/triwiki/context-graph/store/snapshot-store.js +155 -0
  135. package/dist/core/triwiki/triwiki-proof-bank-index-repair.js +115 -0
  136. package/dist/core/triwiki/triwiki-proof-bank-index-store.js +290 -0
  137. package/dist/core/triwiki/triwiki-proof-bank-index.js +126 -0
  138. package/dist/core/triwiki/triwiki-proof-bank.js +7 -1
  139. package/dist/core/verification/context-graph-affected.js +271 -0
  140. package/dist/core/version.js +1 -1
  141. package/dist/scripts/context-graph-check.js +191 -0
  142. package/dist/scripts/helper-dedup-check.js +0 -1
  143. package/dist/scripts/installed-package-smoke-check.js +4 -1
  144. package/dist/scripts/latest-version-guidance-check.js +74 -0
  145. package/dist/scripts/release-metadata-check.js +20 -3
  146. package/dist/scripts/ux-review-imagegen-blackbox-check.js +25 -1
  147. package/dist/scripts/ux-review-run-wires-imagegen-check.js +9 -1
  148. package/package.json +5 -3
  149. package/release-gates.v2.json +174 -0
  150. package/schemas/triwiki/context-graph.schema.json +119 -0
  151. package/dist/core/triwiki/code-index-scanner.js +0 -309
package/README.md CHANGED
@@ -22,7 +22,9 @@ Proof-first orchestration for Codex CLI, ChatGPT Desktop, AI coding agents, mult
22
22
  Sneakoscope Codex (`sks`) is an open-source trust layer for Codex CLI and ChatGPT Desktop. It coordinates bounded AI coding agents, records machine-verifiable evidence, preserves project memory, and blocks release claims that are not supported by current tests or artifacts. Search visibility outcomes are measured separately; SKS does not promise rankings or traffic.
23
23
  <!-- END SKS SEARCH VISIBILITY MARKETING -->
24
24
 
25
- Current release: **SKS 7.3.0**, with the package preferred Codex channel at **CLI 0.145.0**. SKS stays version-agnostic: older hosts keep working where capabilities allow, while Menu Bar / Center induce updates to the preferred latest. It resolves managed SKS skills from the authoritative global install, preserves a runnable Naruto child slot when `max_threads=2`, and keeps current-version Menu Bar repair transactional so stamped generations remain verifiable. Naruto uses stable opt-in multi-agent V2 when the host exposes it. Local code search is mode-separated (`sks search files|text|structure|symbol|context`) with optional Rust acceleration and no required `rg`/`ast-grep`/`fd` install — see [docs/architecture/search-engine-target.md](docs/architecture/search-engine-target.md). See [CHANGELOG.md](CHANGELOG.md).
25
+ This README documents package **SKS 7.5.0** its own identity, read from `package.json` and verified by the release gate, not advice about what to install.
26
+
27
+ Use the official latest stable SKS and Codex CLI releases. SKS stays version-agnostic: older hosts keep working where capabilities allow, while Menu Bar / Center induce updates to the latest stable build. Run `sks update-check` for what is installed and read the capability report for what is actually supported — feature availability is decided by capability probes, not by a version number printed in a document. It resolves managed SKS skills from the authoritative global install, preserves a runnable Naruto child slot when `max_threads=2`, and keeps Menu Bar repair transactional so stamped generations remain verifiable. Naruto uses stable opt-in multi-agent V2 when the host exposes it. Local code search is mode-separated (`sks search files|text|structure|symbol|context`); `context` is answered by the compiled TriWiki Context Graph with evidence paths rather than lexical guessing — see [docs/architecture/context-graph.md](docs/architecture/context-graph.md) and [docs/architecture/search-engine-target.md](docs/architecture/search-engine-target.md). See [CHANGELOG.md](CHANGELOG.md).
26
28
 
27
29
  ## What 7.0.0 Ships
28
30
 
@@ -45,8 +47,15 @@ That installs or repairs SKS, runs `sks doctor --fix`, and prepares the Codex Ap
45
47
 
46
48
  For package-managed installs:
47
49
 
50
+ The npm lifecycle is non-mutating outside the installed package by default:
51
+ it restores only the package-local build stamp and prints the explicit setup
52
+ commands. To intentionally run the legacy bootstrap during installation, set
53
+ `SKS_POSTINSTALL_BOOTSTRAP=1`; `SKS_POSTINSTALL_NO_BOOTSTRAP=1` remains the
54
+ stronger safety override.
55
+
48
56
  ```sh
49
57
  npm i -g sneakoscope
58
+ sks bootstrap --yes
50
59
  sks doctor --fix
51
60
  ```
52
61
 
@@ -56,11 +65,11 @@ The SKS menu bar shows the installed Codex CLI version and latest known version.
56
65
 
57
66
  ### Telegram remote coding on this Mac
58
67
 
59
- Open **SKS Center → Remote & Telegram**, create a private bot with BotFather, send `/start` to that bot from the Telegram account you want to pair, then choose **Connect Bot & Register Coding Session…** and paste the token. SKS verifies the bot, stores the token only in macOS Keychain, pairs only that private chat/user, and registers one dedicated session bound to the current project. Choose **Start Hub**, then send ordinary text to the bot. On the first real message, the Hub creates the Codex thread and starts its first turn in the same App Server connection so the thread is durably resumable; later messages resume that exact thread and return the final response to Telegram.
68
+ Open **SKS Center → Remote & Telegram**, create a bot with BotFather, send `/start` to that bot from the Telegram account you want to pair, then choose **Connect Bot & Register Coding Session…** and paste the token. SKS verifies the bot, stores the token only in macOS Keychain, pairs only that private chat/user, and registers one dedicated session bound to the current project. Choose **Start Hub**, then send ordinary text to the bot. On the first real message, the Hub creates the Codex thread and starts its first turn in the same App Server connection so the thread is durably resumable; later messages resume that exact thread and return the final response to Telegram.
60
69
 
61
70
  The Hub runs as a user LaunchAgent and uses `caffeinate -i` while the logged-in Mac is available. The Mac still needs to remain powered on, logged in, awake, and network-connected; closing the lid or logging out can stop access. Telegram input has no arbitrary shell path, runs with approvals disabled and network access disabled inside the Codex workspace sandbox, and cannot target an unpaired chat or another project.
62
71
 
63
- SKS Center is the menu bar companion: install it with `sks menubar install`, then click the SKS icon in the macOS menu bar and choose **Open SKS Control Center…**. Every GUI step above has a CLI equivalent (`sks telegram setup --bot-token-stdin`, `sks telegram hub start`, `sks telegram status`). See **[docs/telegram-and-center.md](docs/telegram-and-center.md)** for the full step-by-step guide, storage locations, security model, and a blocker-by-blocker troubleshooting table.
72
+ SKS Center is the menu bar companion: install it with `sks menubar install`, then click the SKS icon in the macOS menu bar and choose **Open SKS Control Center…**. Every GUI step above has a CLI equivalent (`sks telegram setup --bot-token-stdin`, `sks telegram hub start`, `sks telegram status`). The hub uses long polling, so a bot with an existing webhook must have that webhook removed before the hub can start; SKS fails closed with `telegram_webhook_conflict` and never clears it automatically. See **[docs/telegram-and-center.md](docs/telegram-and-center.md)** for the complete BotFather setup, optional command menu and privacy-mode guidance, secure token rotation, verification, and troubleshooting.
64
73
 
65
74
  ## The Front Door
66
75
 
@@ -84,10 +93,113 @@ Gates are task-profile aware: greetings and answer-only turns create no mission
84
93
 
85
94
  Every installed Codex hook runs one common Naruto decision gate. The gate records `none`, `generic_naruto`, or `route_owned`: Answer, DFix, Wiki, Computer Use, Goal, and simple Git/control turns stay lightweight; ordinary non-trivial work defaults to two independent official subagents; critical work spanning at least three risk domains may use three. Research, AutoResearch, and QA-Loop retain their own exact orchestration contracts instead of receiving a second generic fan-out. Explicit `--agents N` remains authoritative.
86
95
 
87
- SKS installs twenty-five narrow project custom agents, including native AppKit, toolchain, protocol, runtime-reliability, TriWiki-evidence, long-context, Computer Use, Browser/Chrome, and image-generation specialists. Delegation prompts inject at most the three roles recommended for the current goal rather than serializing the full catalog, so expanding role coverage does not serialize the full inventory into every prompt. TriWiki context is also bounded and query-aware: ordinary work receives up to four trust/hydration anchors and complex, parallel, or high-risk work receives up to six, with source hydration required before relying on lower-trust hints. In CLI Zellij mode, the right side is a live observability surface rather than a static lane reservation: one monitor plus one viewport by default (maximum three) shows official thread role/model, redacted live phase/task/file updates from rollout-compatible Codex 0.144.1+ sessions while the current release baseline remains 0.145.0, plus `running`, `verifying`, and trustworthy parent-verdict completion/failure states. Rollout activity is display-only and never completion proof.
96
+ SKS installs twenty-five narrow project custom agents, including native AppKit, toolchain, protocol, runtime-reliability, TriWiki-evidence, long-context, Computer Use, Browser/Chrome, and image-generation specialists. Delegation prompts inject at most the three roles recommended for the current goal rather than serializing the full catalog, so expanding role coverage does not serialize the full inventory into every prompt. TriWiki context is also bounded and query-aware: ordinary work receives up to four trust/hydration anchors and complex, parallel, or high-risk work receives up to six, with source hydration required before relying on lower-trust hints. In CLI Zellij mode, the right side is a live observability surface rather than a static lane reservation: one monitor plus one viewport by default (maximum three) shows official thread role/model, redacted live phase/task/file updates from rollout-compatible Codex sessions on the official latest stable CLI, plus `running`, `verifying`, and trustworthy parent-verdict completion/failure states. Rollout activity is display-only and never completion proof.
88
97
 
89
98
  Official subagent requests use `--agents`; removed scheduler, pool, backend, and model flags fail closed.
90
99
 
100
+ ## Embedding SKS In Another Agent System
101
+
102
+ By default SKS owns the credential: it pins `model_provider="openai"` and `forced_login_method="chatgpt"`, so an operator's interactive ChatGPT session authenticates the run and it cannot drift onto another provider unnoticed.
103
+
104
+ That default is wrong for an unattended host. An orchestrator that already holds and rotates a customer's OpenAI-compatible credential — a local codex-lb endpoint, OpenRouter, any `env_key` provider block — cannot log in interactively on every node, and forcing `chatgpt` makes Codex treat an `auth_mode="apikey"` session as a hard logout and delete `auth.json`. **Host mode** hands that decision back.
105
+
106
+ ```sh
107
+ sks naruto run "task" \
108
+ --auth-mode=host \
109
+ --model-provider=codex-lb \
110
+ --provider-env-key=CODEX_LB_API_KEY
111
+ ```
112
+
113
+ | Surface | Flag | Environment | Effect |
114
+ | --- | --- | --- | --- |
115
+ | Who authenticates | `--auth-mode=host` | `SKS_NARUTO_AUTH_MODE=host` | SKS injects neither `model_provider` nor `forced_login_method`; Codex uses your `config.toml` provider block |
116
+ | Which provider block | `--model-provider=<name>` | `SKS_NARUTO_MODEL_PROVIDER` | Names a `[model_providers.<name>]` block. Host mode only |
117
+ | Which credential variable | `--provider-env-key=<NAME>` | `SKS_NARUTO_PROVIDER_ENV_KEY` | Forwards exactly that variable to the child so the block's `env_key` resolves. Host mode only |
118
+ | Release the login only | `--no-forced-login-method` | `SKS_NARUTO_FORCED_LOGIN_METHOD=none` | Keeps the SKS provider, drops the forced ChatGPT login |
119
+ | Parent model / effort | `--parent-model`, `--parent-effort` | `SKS_NARUTO_PARENT_MODEL`, `SKS_NARUTO_PARENT_EFFORT` | Overrides the built-in parent policy |
120
+ | Subagent model / effort | `--subagent-model`, `--subagent-effort` | `SKS_NARUTO_SUBAGENT_MODEL`, `SKS_NARUTO_SUBAGENT_EFFORT` | Overrides the default subagent policy |
121
+
122
+ Guarantees this contract makes:
123
+
124
+ - **SKS never reads, stores, forwards to a third party, or logs your credential.** It forwards one named environment variable to the Codex child and records only that variable's *name* in receipts. Values of secret-shaped variables are redacted from captured output.
125
+ - **A malformed value blocks the run.** An unknown auth mode, a provider name with a space, an effort tier that is not `minimal|low|medium|high|max`, or a `--provider-env-key` that is absent from the environment all fail before mission state is written. SKS never quietly falls back to its own credential — that surprise is the failure mode this contract exists to prevent.
126
+ - **Mixed configurations are refused.** Naming a provider while SKS still forces a ChatGPT login would authenticate one way and bill another, so it is a blocker rather than a silent precedence rule.
127
+ - **The default is unchanged.** Managed mode still pins the ChatGPT login, and the real-credential smoke gate still proves it.
128
+
129
+ ### Designing an adapter that wraps SKS without fighting it
130
+
131
+ The rule that keeps an adapter conflict-free: **let SKS own the mission, the evidence, and the gates; let the host own the credential, the model policy, and the workspace.** Cross that line — by patching `dist/`, writing `.sneakoscope/` yourself, or re-implementing the gate DAG — and every SKS update breaks you.
132
+
133
+ ```ts
134
+ // acas/adapters/sks.ts — one process boundary, no dist patching.
135
+ import { execFile } from 'node:child_process'
136
+ import { promisify } from 'node:util'
137
+
138
+ const run = promisify(execFile)
139
+
140
+ export interface SksMissionRequest {
141
+ workspace: string // host owns the checkout
142
+ task: string
143
+ agents?: number
144
+ tenant: {
145
+ providerBlock: string // [model_providers.<name>] the host wrote into config.toml
146
+ credentialEnvKey: string // env var the block's env_key points at
147
+ credential: string // held by the host; never persisted by SKS
148
+ parentModel?: string
149
+ subagentModel?: string
150
+ }
151
+ }
152
+
153
+ export async function runSksMission(request: SksMissionRequest) {
154
+ const { stdout } = await run('sks', [
155
+ 'naruto', 'run', request.task,
156
+ '--json',
157
+ ...(request.agents ? ['--agents', String(request.agents)] : []),
158
+ // Host owns authentication and model policy.
159
+ '--auth-mode=host',
160
+ `--model-provider=${request.tenant.providerBlock}`,
161
+ `--provider-env-key=${request.tenant.credentialEnvKey}`,
162
+ ...(request.tenant.parentModel ? [`--parent-model=${request.tenant.parentModel}`] : []),
163
+ ...(request.tenant.subagentModel ? [`--subagent-model=${request.tenant.subagentModel}`] : [])
164
+ ], {
165
+ cwd: request.workspace,
166
+ env: {
167
+ ...process.env,
168
+ // The one variable the provider block resolves. Scope it to this call
169
+ // rather than exporting it process-wide.
170
+ [request.tenant.credentialEnvKey]: request.tenant.credential
171
+ },
172
+ maxBuffer: 64 * 1024 * 1024
173
+ })
174
+ // SKS answers with its own result schema; treat it as the source of truth for
175
+ // status and evidence rather than re-deriving success from stdout text.
176
+ return JSON.parse(stdout)
177
+ }
178
+ ```
179
+
180
+ Then read the outcome through SKS's own surfaces instead of inferring it:
181
+
182
+ ```sh
183
+ sks naruto proof --json # completion proof, blockers, evidence links
184
+ sks triwiki graph-status --fast --json # is the compiled graph usable right now (no git, no spawn)
185
+ sks search context "..." --json # evidence-backed context with reason paths
186
+ ```
187
+
188
+ `graph-status --fast` is the probe to poll from a host loop: it reads the stored
189
+ artifacts only, so it costs no subprocess, and it reports which staleness reasons
190
+ it could not evaluate rather than returning a `fresh` that means less than it
191
+ looks. Drop `--fast` when you want the full git-aware verdict.
192
+
193
+ Adapter rules that keep updates safe:
194
+
195
+ 1. **One process boundary.** Shell out to the `sks` CLI with `--json`. Do not import SKS internals; they are not a published API and they move.
196
+ 2. **Never patch `dist/`.** A local patch is overwritten by every install and is asserted against by release gates. If a behaviour you need is missing, it belongs behind a flag like the ones above.
197
+ 3. **Host owns the workspace, SKS owns `.sneakoscope/`.** Write your own state anywhere else; treat `.sneakoscope/` as SKS-owned and read-only from outside.
198
+ 4. **Pass credentials per invocation, not per machine.** A per-call `env` entry keeps one tenant's key out of another tenant's run.
199
+ 5. **Let the gates fail.** A blocked mission with blockers is a correct answer. Do not retry it with safety flags off, and do not treat `--trusted-project` as a default — it is an operator decision about a reviewed checkout.
200
+ 6. **Do not pin a version in your own docs or error strings.** Ask for the official latest stable release and read the capability report; SKS enforces this on itself with the `latest-version:guidance` gate.
201
+ 7. **Parallelism advice is advisory.** `sks naruto` decides its own wave shape; if you plan slices yourself, check them against the graph advisory rather than assuming disjointness.
202
+
91
203
  ## Why Not Just An LLM Reviewer?
92
204
 
93
205
  | Question | Oracle-style LLM review | SKS gate/review |
@@ -115,7 +227,7 @@ It shows the current quickstart flow: one-line install, `$sks-plan`, `sks review
115
227
  - Project memory: `sks memory build`
116
228
  - Codebase index/pack for LLM context: `sks wiki refresh --code`, `sks wiki validate --json` (code-pack freshness)
117
229
  - Native capability repair: `sks doctor --fix` (imagegen/Computer Use/Browser Use), `.sneakoscope/reports/native-capability-readiness.json`
118
- - codex-lb continuity: `sks codex-lb status --json` verifies the selected proxy's unauthenticated `/health` `X-App-Version`. Tool-heavy continuation requires codex-lb `1.21.0-beta.3` or later; older or unverified deployments block setup, doctor, and launch instead of silently falling back.
230
+ - codex-lb continuity: `sks codex-lb status --json` verifies the selected proxy's unauthenticated `/health` `X-App-Version`. Tool-heavy continuation requires a codex-lb deployment that reports the capability; use the official latest stable release. Older or unverified deployments block setup, doctor, and launch instead of silently falling back.
119
231
  - Agent bridge for any agent system: `sks mcp-server`, `sks agent-bridge setup`, `SKS_AGENT_MODE=1` — see [docs/AGENT-BRIDGE.md](docs/AGENT-BRIDGE.md)
120
232
  - Release gates: `npm run release:check:affected` for ordinary change-aware verification and `npm run release:check:confidence` for the final local confidence pass.
121
233
  - Release preparation: typecheck, one clean build, focused tests, affected/confidence gates, then `npm publish --dry-run --json --registry https://registry.npmjs.org/ --tag latest --access public`. The dry-run does not publish; authorization remains a separate maintainer workflow.
@@ -259,7 +259,7 @@ dependencies = [
259
259
 
260
260
  [[package]]
261
261
  name = "sks-core"
262
- version = "7.3.0"
262
+ version = "7.5.0"
263
263
  dependencies = [
264
264
  "globset",
265
265
  "grep-matcher",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "sks-core"
3
- version = "7.3.0"
3
+ version = "7.5.0"
4
4
  edition = "2021"
5
5
 
6
6
  [dependencies]
@@ -37,7 +37,7 @@ function remoteControlHelp() {
37
37
  return [
38
38
  'Usage: sks codex-app remote-control [--status|--check|--dry-run|--json] [-- <codex remote-control args>]',
39
39
  '',
40
- 'Starts Codex CLI 0.130.0+ remote-control, the headless remotely controllable app-server entrypoint.',
40
+ 'Starts Codex CLI remote-control, the headless remotely controllable app-server entrypoint.',
41
41
  'SKS only wraps the first-party command and refuses older Codex CLI versions instead of falling back to app-server internals.'
42
42
  ].join('\n');
43
43
  }
@@ -30,7 +30,7 @@ const COMMAND_MANIFEST_LITE_BASE = [
30
30
  { name: 'git', summary: 'Inspect and enforce SKS git collaboration hygiene', maturity: 'beta' },
31
31
  { name: 'paths', summary: 'Inspect SKS managed paths', maturity: 'beta', readonly: true, allowedDuringActiveRoute: true, diagnostic: true },
32
32
  { name: 'rollback', summary: 'List or apply managed-path rollback actions', maturity: 'beta', skipMigrationGate: true, allowedDuringActiveRoute: true, diagnostic: true },
33
- { name: 'postinstall', summary: 'Run postinstall bootstrap', maturity: 'stable', skipMigrationGate: true },
33
+ { name: 'postinstall', summary: 'Restore package state; bootstrap only with explicit opt-in', maturity: 'stable', skipMigrationGate: true },
34
34
  { name: 'codex', summary: 'Check Codex CLI compatibility and vendored hook schemas', maturity: 'beta', skipMigrationGate: true },
35
35
  { name: 'codex-app', summary: 'Check Codex App readiness', maturity: 'beta', skipMigrationGate: true },
36
36
  { name: 'codex-native', summary: 'Inspect Codex Native broker and routing readiness', maturity: 'beta' },
@@ -201,6 +201,7 @@ export function commandInputSchema(profile) {
201
201
  mission: boundedString(1, 160),
202
202
  agents: { type: 'integer', minimum: 1 },
203
203
  max_threads: { type: 'integer', minimum: 1 },
204
+ stdin: { type: 'boolean' },
204
205
  readonly: { type: 'boolean' },
205
206
  trusted_project: { type: 'boolean' },
206
207
  json: { type: 'boolean' }
@@ -25,7 +25,8 @@ async function codexLbLoginCallCount(home) {
25
25
  function codexLbPostinstallEnv(baseEnv, overrides = {}) {
26
26
  return {
27
27
  ...baseEnv,
28
- SKS_POSTINSTALL_NO_BOOTSTRAP: '1',
28
+ SKS_POSTINSTALL_BOOTSTRAP: '1',
29
+ SKS_POSTINSTALL_NO_BOOTSTRAP: '',
29
30
  SKS_SKIP_POSTINSTALL_SHIM: '1',
30
31
  SKS_SKIP_POSTINSTALL_CONTEXT7: '1',
31
32
  SKS_SKIP_POSTINSTALL_GETDESIGN: '1',
@@ -252,22 +252,12 @@ export async function ensureGlobalCodexSkillsDuringInstall(opts = {}) {
252
252
  }
253
253
  }
254
254
  export async function ensureGlobalGetdesignSkillDuringInstall() {
255
- if (process.env.SKS_SKIP_POSTINSTALL_GETDESIGN === '1')
256
- return { status: 'skipped', reason: 'SKS_SKIP_POSTINSTALL_GETDESIGN=1' };
257
- const pathEnv = process.env.PATH || '';
258
- const skillsBin = await findCommandOnPath('skills', pathEnv);
259
- if (!skillsBin)
260
- return { status: 'skills_cli_missing', install: GETDESIGN_REFERENCE.codex_skill_install };
261
- const add = await runProcess(skillsBin, ['add', GETDESIGN_REFERENCE.codex_skill], {
262
- timeoutMs: 30000,
263
- maxOutputBytes: 64 * 1024
264
- }).catch((err) => ({ code: 1, stdout: '', stderr: err.message }));
265
- const out = `${add.stdout || ''}\n${add.stderr || ''}`;
266
- if (add.code === 0)
267
- return { status: /already|exists|present/i.test(out) ? 'present' : 'installed', command: skillsBin };
268
- if (/already|exists|present/i.test(out))
269
- return { status: 'present', command: skillsBin };
270
- return { status: 'failed', command: skillsBin, error: out.trim() || 'skills add failed' };
255
+ return {
256
+ status: 'skipped',
257
+ reason: 'manual_install_only',
258
+ install: GETDESIGN_REFERENCE.codex_skill_install,
259
+ reviewed_ref: GETDESIGN_REFERENCE.codex_skill_ref
260
+ };
271
261
  }
272
262
  export async function ensureCodexImagegenDuringInstall(opts = {}) {
273
263
  if (process.env.SKS_POSTINSTALL_SKIP_IMAGEGEN_REPAIR === '1' || opts.skip === true) {
@@ -35,24 +35,31 @@ function packagedSksEntrypoint() {
35
35
  }
36
36
  export async function postinstall({ bootstrap, args = [] }) {
37
37
  const installRoot = path.resolve(process.env.INIT_CWD || process.cwd());
38
- const conflictScan = await scanHarnessConflicts(installRoot);
39
- if (conflictScan.hard_block) {
40
- await postinstallHarnessConflictNotice(conflictScan);
38
+ console.log('\nSKS installed.');
39
+ await restoreInstalledPackageBuildStamp();
40
+ if (!postinstallExternalMutationsAllowed(process.env)) {
41
+ console.log('Automatic bootstrap was not run; npm install leaves project, HOME, Codex, and global SKS state unchanged by default.');
42
+ console.log('Next: run `sks bootstrap` when you are ready to initialize SKS.');
43
+ console.log('Dependency diagnostics remain explicit: sks deps check');
44
+ console.log('Explicit lifecycle opt-in: SKS_POSTINSTALL_BOOTSTRAP=1 npm i -g sneakoscope');
45
+ console.log('Optional Homebrew/npm-global tool repair remains off unless SKS_POSTINSTALL_AUTO_INSTALL_CLI_TOOLS=1 is also set.');
46
+ const reason = process.env.SKS_POSTINSTALL_NO_BOOTSTRAP === '1'
47
+ ? 'SKS_POSTINSTALL_NO_BOOTSTRAP=1'
48
+ : 'explicit opt-in required (SKS_POSTINSTALL_BOOTSTRAP=1)';
49
+ console.log(`Reason: ${reason}.`);
41
50
  return;
42
51
  }
43
- const codexLbConfigSnapshot = await capturePostinstallCodexLbConfigSnapshot();
52
+ let codexLbConfigSnapshot = null;
53
+ let reconcileCodexLb = false;
44
54
  try {
45
- console.log('\nSKS installed.');
46
- try {
47
- const stampLib = await import('../scripts/lib/ensure-dist-fresh.js');
48
- await fsp.access(stampLib.distStampPath).catch(async () => {
49
- await fsp.writeFile(stampLib.distStampPath, `${JSON.stringify(stampLib.buildStampPayload(), null, 2)}\n`);
50
- console.log('SKS build stamp: restored for update self-verification (npm packages ship without it).');
51
- });
52
- }
53
- catch (err) {
54
- console.log(`SKS build stamp: could not restore (${err?.message || err}); \`sks update\` self-verification may report dist_stamp missing.`);
55
+ const bootstrapDecision = await postinstallBootstrapDecision(installRoot);
56
+ const conflictScan = await scanHarnessConflicts(installRoot);
57
+ if (conflictScan.hard_block) {
58
+ await postinstallHarnessConflictNotice(conflictScan);
59
+ return;
55
60
  }
61
+ codexLbConfigSnapshot = await capturePostinstallCodexLbConfigSnapshot();
62
+ reconcileCodexLb = true;
56
63
  const shim = await ensureSksCommandDuringInstall();
57
64
  if (shim.status === 'present')
58
65
  console.log(`SKS command: available (${shim.command ?? 'unknown'}).`);
@@ -150,35 +157,43 @@ export async function postinstall({ bootstrap, args = [] }) {
150
157
  else if (globalSkills.status === 'failed')
151
158
  console.log(`Codex App global $ skills: auto setup failed. Run \`sks doctor --fix\`. ${globalSkills.error || ''}`.trim());
152
159
  const getdesignSkill = await ensureGlobalGetdesignSkillDuringInstall();
153
- if (getdesignSkill.status === 'installed')
154
- console.log('getdesign Codex skill: installed.');
155
- else if (getdesignSkill.status === 'present')
156
- console.log('getdesign Codex skill: already available.');
157
- else if (getdesignSkill.status === 'skills_cli_missing')
158
- console.log(`getdesign Codex skill: skills CLI missing; generated getdesign-reference skill is installed. Later run \`${getdesignSkill.install}\` if the skills CLI is available.`);
159
- else if (getdesignSkill.status === 'skipped')
160
- console.log(`getdesign Codex skill: skipped (${getdesignSkill.reason}).`);
161
- else if (getdesignSkill.status === 'failed')
162
- console.log(`getdesign Codex skill: auto setup failed; generated getdesign-reference skill remains available. ${getdesignSkill.error || ''}`.trim());
163
- const bootstrapDecision = await postinstallBootstrapDecision(installRoot);
164
- if (bootstrapDecision.run) {
165
- console.log(`SKS bootstrap: ${bootstrapDecision.reason}.`);
166
- await runPostinstallBootstrap(installRoot, bootstrap);
167
- return;
168
- }
169
- console.log('\nNext:');
170
- console.log(' sks bootstrap');
171
- console.log(`\nSKS bootstrap was not run automatically: ${bootstrapDecision.reason}.`);
172
- console.log('This initializes the current project, installs SKS Codex App skills, verifies Codex App/Context7 readiness, and checks Zellij runtime dependencies.');
173
- console.log('Dependency repair: sks bootstrap --yes, sks deps check --yes, or sks --mad --yes. Postinstall reports missing CLI tools but does not mutate Homebrew/npm globals unless SKS_POSTINSTALL_AUTO_INSTALL_CLI_TOOLS=1 is set.');
174
- console.log('Open runtime after readiness is green: sks\n');
160
+ console.log(`getdesign Codex skill: not installed automatically; generated getdesign-reference skill is available. To install the upstream skill manually, review commit ${getdesignSkill.reviewed_ref} and run \`${getdesignSkill.install}\`.`);
161
+ console.log(`SKS bootstrap: ${bootstrapDecision.reason}.`);
162
+ await runPostinstallBootstrap(installRoot, bootstrap, bootstrapDecision);
163
+ return;
175
164
  }
176
165
  catch (err) {
177
166
  console.log(`\nSKS postinstall: a setup step did not complete; installation continues. Run \`sks doctor --fix\` afterward. (${err?.message || err})`);
178
167
  }
179
168
  finally {
180
- await restorePostinstallCodexLbConfigSnapshot(codexLbConfigSnapshot).catch(() => { });
181
- await reportPostinstallCodexLbAuth(codexLbConfigSnapshot).catch(() => { });
169
+ if (reconcileCodexLb) {
170
+ await restorePostinstallCodexLbConfigSnapshot(codexLbConfigSnapshot).catch(() => { });
171
+ await reportPostinstallCodexLbAuth(codexLbConfigSnapshot).catch(() => { });
172
+ }
173
+ }
174
+ }
175
+ function postinstallExternalMutationsAllowed(env) {
176
+ return env.SKS_POSTINSTALL_BOOTSTRAP === '1' && env.SKS_POSTINSTALL_NO_BOOTSTRAP !== '1';
177
+ }
178
+ async function restoreInstalledPackageBuildStamp() {
179
+ try {
180
+ const stampLib = await import('../scripts/lib/ensure-dist-fresh.js');
181
+ const root = path.resolve(packageRoot());
182
+ const rawStamp = String(stampLib.distStampPath || '').trim();
183
+ if (!rawStamp)
184
+ throw new Error('dist_stamp_path_missing');
185
+ const stamp = path.resolve(rawStamp);
186
+ const relative = path.relative(root, stamp);
187
+ if (relative.startsWith('..') || path.isAbsolute(relative)) {
188
+ throw new Error('dist_stamp_outside_package_root');
189
+ }
190
+ await fsp.access(stamp).catch(async () => {
191
+ await fsp.writeFile(stamp, `${JSON.stringify(stampLib.buildStampPayload(), null, 2)}\n`);
192
+ console.log('SKS build stamp: restored inside the installed package for update self-verification.');
193
+ });
194
+ }
195
+ catch (err) {
196
+ console.log(`SKS build stamp: could not restore (${err?.message || err}); \`sks update\` self-verification may report dist_stamp missing.`);
182
197
  }
183
198
  }
184
199
  async function runPostinstallProjectRetentionCleanup(root) {
@@ -294,23 +309,17 @@ function shouldAskPostinstallQuestion() {
294
309
  export async function postinstallBootstrapDecision(root) {
295
310
  if (process.env.SKS_POSTINSTALL_NO_BOOTSTRAP === '1')
296
311
  return { run: false, reason: 'SKS_POSTINSTALL_NO_BOOTSTRAP=1' };
297
- if (process.env.SKS_POSTINSTALL_BOOTSTRAP === '0')
298
- return { run: false, reason: 'SKS_POSTINSTALL_BOOTSTRAP=0' };
312
+ if (process.env.SKS_POSTINSTALL_BOOTSTRAP !== '1') {
313
+ return { run: false, reason: 'explicit opt-in required (SKS_POSTINSTALL_BOOTSTRAP=1)' };
314
+ }
299
315
  const installRoot = path.resolve(root || process.cwd());
300
316
  const candidate = await isProjectSetupCandidate(installRoot);
301
317
  const target = candidate ? installRoot : globalSksRoot();
302
- if (process.env.SKS_POSTINSTALL_BOOTSTRAP === '1')
303
- return { run: true, target, reason: 'forced by SKS_POSTINSTALL_BOOTSTRAP=1' };
304
- if (process.env.npm_config_global === 'true' && candidate) {
305
- return { run: true, target: globalSksRoot(), reason: 'global install: bootstrapping global SKS runtime only (run `sks setup` inside a project to initialize it)' };
306
- }
307
- if (candidate)
308
- return { run: true, target, reason: 'auto-running sks setup --bootstrap --install-scope global --force' };
309
- return { run: true, target, reason: 'no project marker found; auto-running global SKS runtime bootstrap' };
318
+ return { run: true, target, reason: 'forced by SKS_POSTINSTALL_BOOTSTRAP=1' };
310
319
  }
311
- async function runPostinstallBootstrap(root, bootstrap) {
320
+ async function runPostinstallBootstrap(root, bootstrap, selectedDecision) {
312
321
  const previousCwd = process.cwd();
313
- const decision = await postinstallBootstrapDecision(root);
322
+ const decision = selectedDecision || await postinstallBootstrapDecision(root);
314
323
  const target = path.resolve(decision.target || root || previousCwd);
315
324
  await ensureDir(target);
316
325
  process.chdir(target);
@@ -223,9 +223,17 @@ export function safeActiveRouteContinuation(command, args, state = {}) {
223
223
  const subcommand = String(args[0] || '').toLowerCase();
224
224
  const activeRoute = String(state.route || state.route_command || state.mode || '').replace(/^\$/, '').replace(/[-_]/g, '').toUpperCase();
225
225
  if (command === 'naruto') {
226
- if (activeRoute !== 'NARUTO' || subcommand !== 'run')
226
+ if (activeRoute !== 'NARUTO')
227
227
  return false;
228
228
  const requestedMission = optionValue(args, ['--mission', '--mission-id']);
229
+ if (subcommand === 'parent-summary') {
230
+ const explicitParentSummaryMission = optionValue(args, ['--mission']);
231
+ return Boolean(state.mission_id)
232
+ && explicitParentSummaryMission === String(state.mission_id)
233
+ && args.includes('--stdin');
234
+ }
235
+ if (subcommand !== 'run')
236
+ return false;
229
237
  return Boolean(state.mission_id)
230
238
  && (requestedMission === String(state.mission_id) || requestedMission === 'latest');
231
239
  }