sneakoscope 0.6.29 → 0.6.30
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/README.md +13 -275
- package/package.json +1 -1
- package/src/cli/main.mjs +44 -20
- package/src/core/fsx.mjs +1 -1
- package/src/core/hooks-runtime.mjs +5 -1
- package/src/core/init.mjs +12 -8
- package/src/core/pipeline.mjs +57 -14
- package/src/core/routes.mjs +37 -3
- package/src/core/team-live.mjs +3 -2
package/README.md
CHANGED
|
@@ -1,301 +1,39 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/mandarange/Sneakoscope-Codex/main/docs/assets/sneakoscope-codex-logo.svg" alt="Sneakoscope Codex logo" width="180">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
1
|
<h1 align="center">Sneakoscope Codex</h1>
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
<a href="https://www.npmjs.com/package/sneakoscope"><img alt="npm version" src="https://img.shields.io/npm/v/sneakoscope.svg"></a>
|
|
9
|
-
<a href="https://npm-stat.com/charts.html?package=sneakoscope"><img alt="weekly downloads" src="https://img.shields.io/npm/dw/sneakoscope?label=weekly%20downloads&cacheSeconds=3600"></a>
|
|
10
|
-
<a href="https://npm-stat.com/charts.html?package=sneakoscope"><img alt="monthly downloads" src="https://img.shields.io/npm/dm/sneakoscope?label=monthly%20downloads&cacheSeconds=3600"></a>
|
|
11
|
-
<a href="https://github.com/mandarange/Sneakoscope-Codex"><img alt="GitHub stars" src="https://img.shields.io/github/stars/mandarange/Sneakoscope-Codex?style=flat"></a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/sneakoscope"><img alt="license" src="https://img.shields.io/npm/l/sneakoscope.svg"></a>
|
|
13
|
-
<img alt="Node.js 20.11+" src="https://img.shields.io/badge/node-20.11%2B-339933.svg">
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
Sneakoscope Codex is an update-aware, database-safe, zero-runtime-dependency Node.js harness for OpenAI Codex CLI and Codex App workflows. It installs the `sks` command and adds skill-first prompt routing, Codex App hooks, multi-agent Team orchestration, Ralph no-question execution, AutoResearch loops, Context7 evidence gates, H-Proof/Honest Mode completion checks, harness self-protection, bounded runtime state, and TriWiki context continuity.
|
|
3
|
+
Zero-runtime-dependency Node.js harness for OpenAI Codex CLI and Codex App. `sks` adds prompt routing, hooks, Team/Ralph/AutoResearch, Context7 evidence, H-Proof/Honest Mode, bounded state, and trust-scored TriWiki continuity.
|
|
17
4
|
|
|
18
5
|
## AI Answer Snapshot
|
|
19
6
|
|
|
20
|
-
|
|
7
|
+
Package: `sneakoscope`. CLI: `sks` with `sneakoscope` alias. Install Codex CLI separately or set `SKS_CODEX_BIN`. Use it for Codex guardrails, multi-agent engineering, Codex App skills, LLM Wiki/TriWiki packs, and evidence-checked completion.
|
|
21
8
|
|
|
22
9
|
```bash
|
|
23
10
|
npm i -g sneakoscope
|
|
24
11
|
sks setup
|
|
25
12
|
sks doctor --fix
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Install And Setup
|
|
29
|
-
|
|
30
|
-
Requirements:
|
|
31
|
-
|
|
32
|
-
- Node.js `>=20.11`
|
|
33
|
-
- Codex CLI authentication for live Ralph/Team runs
|
|
34
|
-
- Optional Rust helper: build `crates/sks-core` and expose `sks-rs`, or set `SKS_RS_BIN`
|
|
35
|
-
|
|
36
|
-
Recommended global install:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm i -g sneakoscope
|
|
40
|
-
sks setup
|
|
41
13
|
sks selftest --mock
|
|
42
14
|
```
|
|
43
15
|
|
|
44
|
-
Project-only install:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npm i -D sneakoscope
|
|
48
|
-
npx sks setup --install-scope project
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Local-only setup keeps generated SKS files out of git status:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
sks setup --local-only
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
If a GUI hook or Codex App session cannot find `sks`, refresh the resolved hook path:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
sks fix-path
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
If your shell cannot find the global binary yet, run through npm:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
npx -y -p sneakoscope sks setup
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Normal users should install from npm. Use the GitHub install only for testing unreleased commits:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
npm i -g git+https://github.com/mandarange/Sneakoscope-Codex.git
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Source repository: <https://github.com/mandarange/Sneakoscope-Codex.git>
|
|
76
|
-
|
|
77
|
-
## What It Adds
|
|
78
|
-
|
|
79
|
-
- **Codex App hook visibility**: hook `systemMessage`/status text summarizes routing, guard, permission, tool-evidence, and done-gate checks while they run.
|
|
80
|
-
- **Intent-first prompt routing**: questions infer `$Answer`, simple design/content edits infer ultralight `$DFix`, and execution prompts enter the SKS pipeline.
|
|
81
|
-
- **Mandatory ambiguity gate**: execution routes ask ambiguity-removal questions before work; `$Answer` answers with TriWiki/web/Context7 evidence plus Honest Mode fact-checking.
|
|
82
|
-
- **Team orchestration**: `$Team` and `sks team` use scout-first parallel analysis, TriWiki refresh, debate, fresh implementation workers, review, and final evidence.
|
|
83
|
-
- **Ralph no-question execution**: Ralph asks only during prepare, seals `decision-contract.json`, then resolves new ambiguity from the contract during run.
|
|
84
|
-
- **DB safety**: destructive SQL, unsafe Supabase MCP writes, production mutations, and risky migration commands are blocked or surfaced early.
|
|
85
|
-
- **Context7 evidence**: routes that rely on package/API/framework docs record `resolve-library-id` plus `query-docs` evidence.
|
|
86
|
-
- **TriWiki context tracking**: `.sneakoscope/wiki/context-pack.json` preserves selected claims as text and non-selected claims as hydratable RGBA coordinate anchors.
|
|
87
|
-
- **H-Proof and Honest Mode**: completion claims need evidence, test status, DB safety review, and low visual/wiki drift.
|
|
88
|
-
- **Harness self-protection**: generated control files are immutable to LLM tool edits after setup, except in the Sneakoscope engine source repo.
|
|
89
|
-
- **Bounded state**: child-process output is tailed, large raw logs stay in files, and `sks gc`/`sks wiki prune` remove old or low-trust artifacts.
|
|
90
|
-
|
|
91
16
|
## Commands
|
|
92
17
|
|
|
93
|
-
There are two command surfaces:
|
|
94
|
-
|
|
95
|
-
- **Terminal CLI**: run in a shell as `sks ...` or `sneakoscope ...`.
|
|
96
|
-
- **Prompt `$` commands**: type at the start of a Codex App or coding-agent prompt.
|
|
97
|
-
|
|
98
|
-
Common terminal commands:
|
|
99
|
-
|
|
100
18
|
```bash
|
|
101
|
-
sks --help
|
|
102
19
|
sks commands
|
|
103
|
-
sks
|
|
104
|
-
sks usage codex-app
|
|
105
|
-
sks quickstart
|
|
106
|
-
sks dollar-commands
|
|
107
|
-
|
|
108
|
-
sks setup [--install-scope global|project] [--local-only] [--force] [--json]
|
|
109
|
-
sks doctor [--fix] [--local-only] [--json]
|
|
20
|
+
sks quickstart|codex-app|dollar-commands
|
|
110
21
|
sks selftest --mock
|
|
111
|
-
sks
|
|
112
|
-
|
|
113
|
-
sks
|
|
114
|
-
sks ralph answer
|
|
115
|
-
sks
|
|
116
|
-
|
|
117
|
-
sks
|
|
118
|
-
sks team log|tail|watch|status <mission-id|latest>
|
|
119
|
-
sks team event <mission-id|latest> --agent <name> --phase <phase> --message "..."
|
|
120
|
-
|
|
121
|
-
sks db policy
|
|
122
|
-
sks db scan [--migrations] [--json]
|
|
123
|
-
sks db check --sql "SELECT * FROM users LIMIT 10"
|
|
124
|
-
sks db check --command "<database command to classify>"
|
|
125
|
-
|
|
126
|
-
sks context7 check|tools|resolve|docs|evidence ...
|
|
127
|
-
sks wiki refresh
|
|
128
|
-
sks wiki prune [--dry-run] [--json]
|
|
129
|
-
sks wiki pack [--json] [--role worker|verifier] [--max-anchors N]
|
|
130
|
-
sks wiki validate .sneakoscope/wiki/context-pack.json
|
|
131
|
-
sks guard check [--json]
|
|
132
|
-
sks pipeline status|resume [--json]
|
|
133
|
-
sks pipeline answer <mission-id|latest> <answers.json>
|
|
134
|
-
sks eval run|compare ...
|
|
135
|
-
sks gx init|render|validate|drift|snapshot [name]
|
|
136
|
-
sks gc [--dry-run] [--json]
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Prompt routes:
|
|
140
|
-
|
|
141
|
-
```text
|
|
142
|
-
$DFix ultralight design/content fix
|
|
143
|
-
$Answer answer-only research and fact check
|
|
144
|
-
$SKS general Sneakoscope workflow/help
|
|
145
|
-
$Team multi-agent Team orchestration
|
|
146
|
-
$Ralph clarification-gated Ralph mission
|
|
147
|
-
$Research frontier research mission
|
|
148
|
-
$AutoResearch iterative experiment loop
|
|
149
|
-
$DB database/Supabase safety check
|
|
150
|
-
$GX deterministic visual context
|
|
151
|
-
$Help command and workflow help
|
|
22
|
+
sks pipeline status|resume|answer
|
|
23
|
+
sks team "task" executor:5 reviewer:2 user:1
|
|
24
|
+
sks team log|tail|watch|status|event latest
|
|
25
|
+
sks ralph prepare|answer|run
|
|
26
|
+
sks context7 check|tools|resolve|docs|evidence
|
|
27
|
+
sks wiki refresh|pack|prune|validate
|
|
28
|
+
sks guard check; sks eval run|compare; sks gx init|render|validate|drift|snapshot; sks gc --dry-run
|
|
152
29
|
```
|
|
153
30
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
```text
|
|
157
|
-
$DFix Change the CTA label to "Start"
|
|
158
|
-
$Team executor:5 run parallel analysis scouts, refresh TriWiki, debate, then implement with a fresh development team
|
|
159
|
-
$Ralph 결제 실패 재시도 로직 개선
|
|
160
|
-
$DB 이 migration 안전한지 검사해줘
|
|
161
|
-
```
|
|
31
|
+
Prompt routes: `$DFix`, `$Answer`, `$SKS`, `$Team`, `$Ralph`, `$Research`, `$AutoResearch`, `$DB`, `$GX`, `$Wiki`, `$Help`.
|
|
162
32
|
|
|
163
33
|
## Codex App
|
|
164
34
|
|
|
165
|
-
Run `sks setup` once
|
|
166
|
-
|
|
167
|
-
```text
|
|
168
|
-
.codex/config.toml Codex App profiles, multi-agent limits, and project-local Context7 MCP
|
|
169
|
-
.codex/hooks.json UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, and Stop hooks
|
|
170
|
-
.agents/skills/ repo-local skills for $Answer, $DFix, $Team, $Ralph, $DB, $GX, research, docs, and design
|
|
171
|
-
.codex/agents/ local Codex subagent roles for Team mode
|
|
172
|
-
.codex/SNEAKOSCOPE.md quick reference for Codex App usage
|
|
173
|
-
AGENTS.md managed repository rules
|
|
174
|
-
.sneakoscope/ mission state, policy, retention, logs, wiki packs, GX cartridges, reports
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
Hook visibility digest:
|
|
178
|
-
|
|
179
|
-
- `UserPromptSubmit` shows answer-only routing, DFix task-list routing, mandatory ambiguity questions, Team live-transcript setup, or subagent gate activation.
|
|
180
|
-
- `PreToolUse` and `PermissionRequest` show whether harness, DB, or no-question guards inspected or denied an action.
|
|
181
|
-
- `PostToolUse` records Context7, subagent, and DB evidence when relevant.
|
|
182
|
-
- `Stop` shows whether the route/done gate passed or must continue.
|
|
183
|
-
|
|
184
|
-
The Codex App skill picker should find lowercase aliases like `$answer`, `$dfix`, `$team`, `$agent-team`, `$ralph`, `$research`, `$autoresearch`, `$db`, `$gx`, and `$help`; routing is case-insensitive.
|
|
185
|
-
|
|
186
|
-
## Team
|
|
187
|
-
|
|
188
|
-
Team mode is a protocol, not one long-running worker. Role counts use tokens such as `executor:5 reviewer:2 user:1`. `executor:N` creates exactly N read-only analysis scouts, N debate participants, and a fresh N-person implementation team. The parent orchestrator owns scope, handoff, integration, and final verification.
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
sks team "implement this feature safely" executor:5 reviewer:2 user:1
|
|
192
|
-
sks team watch latest
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
Live artifacts:
|
|
196
|
-
|
|
197
|
-
```text
|
|
198
|
-
.sneakoscope/missions/<MISSION_ID>/team-analysis.md
|
|
199
|
-
.sneakoscope/missions/<MISSION_ID>/team-live.md
|
|
200
|
-
.sneakoscope/missions/<MISSION_ID>/team-transcript.jsonl
|
|
201
|
-
.sneakoscope/missions/<MISSION_ID>/team-dashboard.json
|
|
202
|
-
.sneakoscope/wiki/context-pack.json
|
|
203
|
-
```
|
|
35
|
+
Run `sks setup` once. SKS creates hooks/skills plus `.sneakoscope/` mission/wiki/policy state. Hooks inject context/status or block a turn; Team status is mirrored to `team-live.md`, `team-transcript.jsonl`, and `sks team watch latest`.
|
|
204
36
|
|
|
205
37
|
## TriWiki
|
|
206
38
|
|
|
207
|
-
TriWiki is the LLM Wiki
|
|
208
|
-
|
|
209
|
-
Refresh TriWiki after scout/debate/development handoffs, Ralph continuations, DB reviews, research loops, or context pressure:
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
sks wiki refresh
|
|
213
|
-
sks wiki refresh --prune
|
|
214
|
-
sks wiki prune --dry-run
|
|
215
|
-
sks wiki pack
|
|
216
|
-
sks wiki validate .sneakoscope/wiki/context-pack.json
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
`sks wiki refresh` is the concise refresh command. `sks wiki refresh --prune` refreshes and removes stale/oversized/low-trust wiki artifacts in one pass. `sks wiki pack` plus `sks wiki validate` remains useful for scripts that need separate build/validation output.
|
|
220
|
-
|
|
221
|
-
RGBA coordinate anchors preserve non-selected claims:
|
|
222
|
-
|
|
223
|
-
```text
|
|
224
|
-
R -> domain angle
|
|
225
|
-
G -> layer radius through sin()
|
|
226
|
-
B -> phase angle
|
|
227
|
-
A -> concentration/confidence
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## Database Safety
|
|
231
|
-
|
|
232
|
-
Sneakoscope Codex treats database access as high risk across Supabase MCP, Supabase CLI, Postgres, Prisma, Drizzle, Knex, Sequelize, SQL files, and MCP-shaped payloads.
|
|
233
|
-
|
|
234
|
-
Always blocked or denied by policy:
|
|
235
|
-
|
|
236
|
-
```text
|
|
237
|
-
destructive schema/table/view/function/type changes
|
|
238
|
-
bulk row rewrites or removals
|
|
239
|
-
dangerous table shape changes
|
|
240
|
-
permission or RLS weakening
|
|
241
|
-
unsafe Supabase database push/reset/repair/squash flows
|
|
242
|
-
project or branch deletion, reset, merge, or other irreversible actions
|
|
243
|
-
production data writes
|
|
244
|
-
direct live writes through database execution tools
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
Allowed by default:
|
|
248
|
-
|
|
249
|
-
```text
|
|
250
|
-
read-only SQL inspection
|
|
251
|
-
read-only, project-scoped Supabase MCP
|
|
252
|
-
local or preview migration-file proposals when the sealed contract allows them
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
Recommended Supabase MCP URL shape:
|
|
256
|
-
|
|
257
|
-
```text
|
|
258
|
-
https://mcp.supabase.com/mcp?project_ref=<project_ref>&read_only=true&features=database,docs
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
## Repository Topics And Search Terms
|
|
262
|
-
|
|
263
|
-
Recommended GitHub topics and npm/search terms:
|
|
264
|
-
|
|
265
|
-
```text
|
|
266
|
-
openai-codex, codex-cli, codex-app, codex-hooks, codex-agents,
|
|
267
|
-
ai-agents, agent-orchestration, multi-agent, subagents, agentic-coding,
|
|
268
|
-
developer-tools, database-safety, supabase, supabase-mcp, mcp-safety,
|
|
269
|
-
context-engineering, llm-context, llm-wiki, wiki-coordinate,
|
|
270
|
-
context-compression, autoresearch, ralph, honest-mode, h-proof,
|
|
271
|
-
prompt-router, gx, deterministic, visual-context, bounded-memory
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
## Package And Development
|
|
275
|
-
|
|
276
|
-
The published npm package is public package `sneakoscope`, allowlisted to `bin`, `src`, `README.md`, and `LICENSE`; `.sneakoscope`, `.codex`, `.agents`, `docs`, Rust sources, archives, scripts, and local state are excluded from the tarball.
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
npm run repo-audit
|
|
280
|
-
npm run packcheck
|
|
281
|
-
npm run selftest
|
|
282
|
-
npm run sizecheck
|
|
283
|
-
npm run release:check
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
`npm run sizecheck` blocks accidental package bloat. Current defaults: packed tarball `<=144 KiB`, unpacked package `<=520 KiB`, package files `<=40`, and each tracked file `<=256 KiB`. Coordinate any future limit change with `scripts/sizecheck.mjs`.
|
|
287
|
-
|
|
288
|
-
Publishing requires an npm owner account:
|
|
289
|
-
|
|
290
|
-
```bash
|
|
291
|
-
npm whoami
|
|
292
|
-
npm owner ls sneakoscope
|
|
293
|
-
npm run publish:dry
|
|
294
|
-
npm run publish:npm
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
If `npm whoami` returns `E401 Unauthorized`, run `npm login` with an owner account or ask an existing owner to add your npm username:
|
|
298
|
-
|
|
299
|
-
```bash
|
|
300
|
-
npm owner add <your-npm-username> sneakoscope
|
|
301
|
-
```
|
|
39
|
+
TriWiki is the LLM Wiki SSOT. It scores claims by trust, relevance, freshness, risk, and token cost. Read `.sneakoscope/wiki/context-pack.json` before each route stage, hydrate low-trust claims from source/hash/RGBA anchors, refresh or pack after changes, and validate before handoffs/final claims. `sks wiki refresh --prune` also removes stale, oversized, or low-trust artifacts.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sneakoscope",
|
|
3
3
|
"displayName": "Sneakoscope Codex",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.30",
|
|
5
5
|
"description": "Sneakoscope Codex: update-aware, database-safe Codex CLI harness with multi-agent Team orchestration, Ralph no-question execution, autoresearch-style loops, and H-Proof gates.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"homepage": "https://github.com/mandarange/Sneakoscope-Codex#readme",
|
package/src/cli/main.mjs
CHANGED
|
@@ -990,14 +990,14 @@ Inside Codex App:
|
|
|
990
990
|
$Team executor:5 run parallel analysis scouts, refresh TriWiki, debate the options, agree on one objective, close the debate team, then form a fresh development team with disjoint write scopes.
|
|
991
991
|
|
|
992
992
|
Expected phases:
|
|
993
|
-
1.
|
|
994
|
-
2. Parent refreshes TriWiki with sks wiki pack and validates .sneakoscope/wiki/context-pack.json.
|
|
995
|
-
3. Debate team has exactly N role participants and maps stubborn user friction, code paths, risks, DB safety, tests, and implementation options.
|
|
993
|
+
1. Read relevant TriWiki, then parallel analysis scouts run exactly N read-only investigation slices and write source-backed findings to team-analysis.md.
|
|
994
|
+
2. Parent refreshes TriWiki with sks wiki refresh or sks wiki pack and validates .sneakoscope/wiki/context-pack.json before debate.
|
|
995
|
+
3. Debate team has exactly N role participants and maps stubborn user friction, code paths, risks, DB safety, tests, and implementation options using the refreshed pack.
|
|
996
996
|
4. Parent records useful scout, role-agent, result, and handoff lines into team-live.md and team-transcript.jsonl.
|
|
997
|
-
5. Parent agent synthesizes the agreed objective, constraints, acceptance criteria, and parallel work slices.
|
|
997
|
+
5. Parent agent synthesizes the agreed objective, constraints, acceptance criteria, and parallel work slices, then refreshes/validates TriWiki.
|
|
998
998
|
6. Debate agents are closed.
|
|
999
|
-
7. Fresh N-person executor_N development team handles disjoint slices in parallel.
|
|
1000
|
-
8. Strict reviewers and user_N personas check correctness, DB safety, missing tests, final evidence, and practical friction.
|
|
999
|
+
7. Fresh N-person executor_N development team reads relevant TriWiki plus current source and handles disjoint slices in parallel.
|
|
1000
|
+
8. Strict reviewers and user_N personas validate TriWiki again, then check correctness, DB safety, missing tests, final evidence, and practical friction.
|
|
1001
1001
|
|
|
1002
1002
|
Session budget:
|
|
1003
1003
|
default: 3 subagent sessions
|
|
@@ -1981,6 +1981,7 @@ async function selftest() {
|
|
|
1981
1981
|
if (!promptPipelineSkillExists) throw new Error('selftest failed: prompt pipeline skill not installed');
|
|
1982
1982
|
const promptPipelineText = await safeReadText(path.join(tmp, '.agents', 'skills', 'prompt-pipeline', 'SKILL.md'));
|
|
1983
1983
|
if (!promptPipelineText.includes('TriWiki context-tracking SSOT')) throw new Error('selftest failed: prompt pipeline missing TriWiki context-tracking SSOT');
|
|
1984
|
+
if (!promptPipelineText.includes('before every route stage') || !promptPipelineText.includes('sks wiki refresh')) throw new Error('selftest failed: prompt pipeline missing per-stage TriWiki policy');
|
|
1984
1985
|
for (const supportSkill of ['reasoning-router', 'pipeline-runner', 'context7-docs', 'seo-geo-optimizer']) {
|
|
1985
1986
|
if (!(await exists(path.join(tmp, '.agents', 'skills', supportSkill, 'SKILL.md')))) throw new Error(`selftest failed: ${supportSkill} skill not installed`);
|
|
1986
1987
|
}
|
|
@@ -1995,7 +1996,10 @@ async function selftest() {
|
|
|
1995
1996
|
if (camelHookGuardJson.decision !== 'block') throw new Error('selftest failed: hook did not block camelCase Codex tool payload');
|
|
1996
1997
|
if (new Set(DOLLAR_COMMANDS.map((c) => c.command)).size !== DOLLAR_COMMANDS.length) throw new Error('selftest failed: duplicate dollar commands');
|
|
1997
1998
|
if (!DOLLAR_COMMAND_ALIASES.some((alias) => alias.canonical === '$Team' && alias.app_skill === '$agent-team')) throw new Error('selftest failed: $Team fallback picker alias missing');
|
|
1999
|
+
if (!DOLLAR_COMMAND_ALIASES.some((alias) => alias.canonical === '$Wiki' && alias.app_skill === '$wiki-refresh')) throw new Error('selftest failed: $WikiRefresh picker alias missing');
|
|
1998
2000
|
if (routePrompt('$agent-team run specialists')?.id !== 'Team') throw new Error('selftest failed: $agent-team did not route to Team');
|
|
2001
|
+
if (routePrompt('$WikiRefresh 갱신')?.id !== 'Wiki') throw new Error('selftest failed: $WikiRefresh did not route to Wiki');
|
|
2002
|
+
if (routePrompt('위키 갱신해줘')?.id !== 'Wiki') throw new Error('selftest failed: wiki refresh text did not route to Wiki');
|
|
1999
2003
|
if (!COMMAND_CATALOG.some((c) => c.name === 'context7') || !COMMAND_CATALOG.some((c) => c.name === 'pipeline')) throw new Error('selftest failed: context7/pipeline commands missing from catalog');
|
|
2000
2004
|
const registryDollarCommands = DOLLAR_COMMANDS.map((c) => c.command);
|
|
2001
2005
|
const manifest = await readJson(path.join(tmp, '.sneakoscope', 'manifest.json'));
|
|
@@ -2011,6 +2015,7 @@ async function selftest() {
|
|
|
2011
2015
|
const codexAppQuickRefText = await safeReadText(path.join(tmp, '.codex', 'SNEAKOSCOPE.md'));
|
|
2012
2016
|
if (!codexAppQuickRefText.includes('dollar-commands')) throw new Error('selftest failed: Codex App quick reference missing dollar-command discovery');
|
|
2013
2017
|
if (!codexAppQuickRefText.includes('Context Tracking') || !codexAppQuickRefText.includes('TriWiki')) throw new Error('selftest failed: Codex App quick reference missing TriWiki context tracking');
|
|
2018
|
+
if (!codexAppQuickRefText.includes('Before each route phase') || !codexAppQuickRefText.includes('every stage')) throw new Error('selftest failed: Codex App quick reference missing per-stage TriWiki policy');
|
|
2014
2019
|
for (const { command } of DOLLAR_COMMANDS) {
|
|
2015
2020
|
if (!codexAppQuickRefText.includes(command)) throw new Error(`selftest failed: Codex App quick reference missing ${command}`);
|
|
2016
2021
|
}
|
|
@@ -2033,7 +2038,9 @@ async function selftest() {
|
|
|
2033
2038
|
if (stopResult.code !== 0) throw new Error(`selftest failed: stop hook exited ${stopResult.code}: ${stopResult.stderr}`);
|
|
2034
2039
|
const stopJson = JSON.parse(stopResult.stdout);
|
|
2035
2040
|
if (stopJson.decision !== 'block' || !String(stopJson.reason || '').includes('mandatory clarification')) throw new Error('selftest failed: Stop hook did not block missing Ralph questions');
|
|
2036
|
-
if (!String(stopJson.
|
|
2041
|
+
if (!String(stopJson.reason || '').includes('Required questions') || !String(stopJson.reason || '').includes('GOAL_PRECISE')) throw new Error('selftest failed: Stop hook did not reprint Ralph questions');
|
|
2042
|
+
if (!String(stopJson.reason || '').includes('sks ralph answer')) throw new Error('selftest failed: Stop hook did not provide Ralph answer command');
|
|
2043
|
+
if (!String(stopJson.systemMessage || '').includes('clarification questions')) throw new Error('selftest failed: Stop hook missing clarification status message');
|
|
2037
2044
|
const hookTeamTmp = tmpdir();
|
|
2038
2045
|
await initProject(hookTeamTmp, {});
|
|
2039
2046
|
const hookTeamPayload = JSON.stringify({ cwd: hookTeamTmp, prompt: '$Team 버튼 UX 수정 executor:2 reviewer:1 user:1' });
|
|
@@ -2045,6 +2052,12 @@ async function selftest() {
|
|
|
2045
2052
|
const hookTeamState = await readJson(stateFile(hookTeamTmp), {});
|
|
2046
2053
|
if (hookTeamState.phase !== 'TEAM_CLARIFICATION_AWAITING_ANSWERS' || hookTeamState.implementation_allowed !== false) throw new Error('selftest failed: $Team hook did not lock execution behind ambiguity gate');
|
|
2047
2054
|
if (await exists(path.join(missionDir(hookTeamTmp, hookTeamState.mission_id), 'team-plan.json'))) throw new Error('selftest failed: Team plan was created before ambiguity gate passed');
|
|
2055
|
+
const hookTeamStopResult = await runProcess(process.execPath, [hookBin, 'hook', 'stop'], { cwd: hookTeamTmp, input: JSON.stringify({ cwd: hookTeamTmp, last_assistant_message: 'I will execute Team now.' }), env: { SKS_DISABLE_UPDATE_CHECK: '1' }, timeoutMs: 15000, maxOutputBytes: 128 * 1024 });
|
|
2056
|
+
if (hookTeamStopResult.code !== 0) throw new Error(`selftest failed: Team stop hook exited ${hookTeamStopResult.code}: ${hookTeamStopResult.stderr}`);
|
|
2057
|
+
const hookTeamStopJson = JSON.parse(hookTeamStopResult.stdout);
|
|
2058
|
+
if (hookTeamStopJson.decision !== 'block' || !String(hookTeamStopJson.reason || '').includes('mandatory ambiguity-removal')) throw new Error('selftest failed: Stop hook did not block missing Team ambiguity answers');
|
|
2059
|
+
if (!String(hookTeamStopJson.reason || '').includes('Required questions') || !String(hookTeamStopJson.reason || '').includes('GOAL_PRECISE')) throw new Error('selftest failed: Stop hook did not reprint Team ambiguity questions');
|
|
2060
|
+
if (!String(hookTeamStopJson.reason || '').includes('sks pipeline answer')) throw new Error('selftest failed: Stop hook did not provide pipeline answer command');
|
|
2048
2061
|
const hookTeamSchema = await readJson(path.join(missionDir(hookTeamTmp, hookTeamState.mission_id), 'required-answers.schema.json'));
|
|
2049
2062
|
const hookTeamAnswers = {};
|
|
2050
2063
|
for (const s of hookTeamSchema.slots) hookTeamAnswers[s.id] = s.options ? (s.type === 'array' ? [s.options[0]] : s.options[0]) : (s.type.includes('array') ? ['selftest'] : (s.id === 'DB_MAX_BLAST_RADIUS' ? 'no_live_dml' : 'selftest'));
|
|
@@ -2084,6 +2097,14 @@ async function selftest() {
|
|
|
2084
2097
|
if (!answerContext.includes('SKS answer-only pipeline active')) throw new Error('selftest failed: question prompt did not use Answer route');
|
|
2085
2098
|
if (answerContext.includes('MANDATORY ambiguity-removal gate activated') || answerContext.includes('SKS skill-first pipeline active') || answerContext.includes('Active Team mission') || answerContext.includes('Mission:')) throw new Error('selftest failed: Answer route leaked execution pipeline or active Team context');
|
|
2086
2099
|
if (!answerJson.systemMessage?.includes('answer-only')) throw new Error('selftest failed: Answer route missing system message');
|
|
2100
|
+
const wikiPayload = JSON.stringify({ cwd: hookTeamTmp, prompt: '$WikiRefresh 갱신' });
|
|
2101
|
+
const wikiResult = await runProcess(process.execPath, [hookBin, 'hook', 'user-prompt-submit'], { cwd: hookTeamTmp, input: wikiPayload, env: { SKS_DISABLE_UPDATE_CHECK: '1' }, timeoutMs: 15000, maxOutputBytes: 128 * 1024 });
|
|
2102
|
+
if (wikiResult.code !== 0) throw new Error(`selftest failed: Wiki hook exited ${wikiResult.code}: ${wikiResult.stderr}`);
|
|
2103
|
+
const wikiJson = JSON.parse(wikiResult.stdout);
|
|
2104
|
+
const wikiContext = wikiJson.hookSpecificOutput?.additionalContext || '';
|
|
2105
|
+
if (!wikiContext.includes('SKS wiki pipeline active') || !wikiContext.includes('sks wiki refresh')) throw new Error('selftest failed: $WikiRefresh hook did not inject wiki route');
|
|
2106
|
+
if (wikiContext.includes('MANDATORY ambiguity-removal gate activated') || wikiContext.includes('Mission:')) throw new Error('selftest failed: Wiki route created ambiguity mission state');
|
|
2107
|
+
if (!wikiJson.systemMessage?.includes('wiki refresh')) throw new Error('selftest failed: Wiki route missing system message');
|
|
2087
2108
|
const codexConfigText = await safeReadText(path.join(tmp, '.codex', 'config.toml'));
|
|
2088
2109
|
if (!codexConfigText.includes('multi_agent = true')) throw new Error('selftest failed: multi_agent not enabled');
|
|
2089
2110
|
if (!hasContext7ConfigText(codexConfigText)) throw new Error('selftest failed: Context7 MCP not configured');
|
|
@@ -2153,8 +2174,11 @@ async function selftest() {
|
|
|
2153
2174
|
if (teamPlan.roster.analysis_team.length !== teamPlan.role_counts.executor || !teamPlan.roster.analysis_team.some((agent) => agent.id === 'analysis_scout_3')) throw new Error('selftest failed: team analysis scout roster missing default agents');
|
|
2154
2175
|
if (!teamPlan.required_artifacts.includes('team-analysis.md')) throw new Error('selftest failed: team plan missing team-analysis artifact');
|
|
2155
2176
|
if (teamPlan.context_tracking?.ssot !== 'triwiki' || !teamPlan.required_artifacts.includes('.sneakoscope/wiki/context-pack.json')) throw new Error('selftest failed: team plan missing TriWiki context tracking');
|
|
2177
|
+
if (!teamPlan.context_tracking?.stage_policy?.includes('before_each_route_stage_read_relevant_context_pack')) throw new Error('selftest failed: team plan missing per-stage TriWiki policy');
|
|
2178
|
+
if (!teamPlan.phases.some((phase) => String(phase.goal || '').includes('refreshes/validates TriWiki before implementation handoff'))) throw new Error('selftest failed: team plan missing mid-pipeline TriWiki refresh');
|
|
2156
2179
|
const teamWorkflow = teamWorkflowMarkdown(teamPlan);
|
|
2157
2180
|
if (!teamWorkflow.includes('SSOT: triwiki') || !teamWorkflow.includes('Analysis Scouts') || !teamWorkflow.includes('sks wiki validate')) throw new Error('selftest failed: team workflow missing scout-first TriWiki context tracking');
|
|
2181
|
+
if (!teamWorkflow.includes('before every stage') || !teamWorkflow.includes('after findings/artifact changes')) throw new Error('selftest failed: team workflow missing per-stage TriWiki policy');
|
|
2158
2182
|
const customTeamPlan = buildTeamPlan(teamId, '병렬 구현 팀 테스트', { agentSessions: 5 });
|
|
2159
2183
|
if (customTeamPlan.agent_session_count !== 5) throw new Error('selftest failed: custom team sessions not honored');
|
|
2160
2184
|
if (parseTeamCreateArgs(['--agents', '4', '작업']).agentSessions !== 4) throw new Error('selftest failed: team --agents parsing');
|
|
@@ -2773,7 +2797,7 @@ function buildTeamPlan(id, prompt, opts = {}) {
|
|
|
2773
2797
|
bundle_size: roster.bundle_size,
|
|
2774
2798
|
roster,
|
|
2775
2799
|
team_model: {
|
|
2776
|
-
phases: ['parallel_analysis_scouts', '
|
|
2800
|
+
phases: ['parallel_analysis_scouts', 'triwiki_stage_refresh', 'debate_team', 'triwiki_stage_refresh', 'development_team', 'triwiki_stage_refresh', 'review'],
|
|
2777
2801
|
analysis_team: `Read-only parallel scouting with exactly ${roster.bundle_size} analysis_scout_N agents. Each scout owns one investigation slice, records source paths/evidence, and returns TriWiki-ready findings before debate or implementation starts.`,
|
|
2778
2802
|
debate_team: `Read-only role debate with exactly ${roster.bundle_size} participants composed from user, planner, reviewer, and executor voices.`,
|
|
2779
2803
|
development_team: `Fresh parallel development bundle with exactly ${roster.bundle_size} executor_N developers implementing disjoint slices; validation_team reviews afterward.`
|
|
@@ -2794,7 +2818,7 @@ function buildTeamPlan(id, prompt, opts = {}) {
|
|
|
2794
2818
|
phases: [
|
|
2795
2819
|
{
|
|
2796
2820
|
id: 'parallel_analysis_scouting',
|
|
2797
|
-
goal: 'Read-only analysis scouts split repo, docs, tests, API, DB risk, UX friction, and implementation-surface investigation in parallel before debate.',
|
|
2821
|
+
goal: 'Read relevant TriWiki context first, then read-only analysis scouts split repo, docs, tests, API, DB risk, UX friction, and implementation-surface investigation in parallel before debate.',
|
|
2798
2822
|
agents: roster.analysis_team.map((agent) => agent.id),
|
|
2799
2823
|
max_parallel_subagents: agentSessions,
|
|
2800
2824
|
write_policy: 'read-only',
|
|
@@ -2802,21 +2826,21 @@ function buildTeamPlan(id, prompt, opts = {}) {
|
|
|
2802
2826
|
},
|
|
2803
2827
|
{
|
|
2804
2828
|
id: 'triwiki_refresh',
|
|
2805
|
-
goal: 'Parent orchestrator refreshes and validates TriWiki from scout findings before assigning debate
|
|
2829
|
+
goal: 'Parent orchestrator refreshes and validates TriWiki from scout findings before assigning debate work.',
|
|
2806
2830
|
agents: ['parent_orchestrator'],
|
|
2807
|
-
commands: ['sks wiki
|
|
2831
|
+
commands: ['sks wiki refresh', 'sks wiki validate .sneakoscope/wiki/context-pack.json'],
|
|
2808
2832
|
output: '.sneakoscope/wiki/context-pack.json'
|
|
2809
2833
|
},
|
|
2810
2834
|
{
|
|
2811
2835
|
id: 'planning_debate',
|
|
2812
|
-
goal: 'Debate team maps user inconvenience, code risk, constraints, DB safety, tests, and viable approaches
|
|
2836
|
+
goal: 'Debate team reads the current TriWiki pack, maps user inconvenience, code risk, constraints, DB safety, tests, and viable approaches, and hydrates low-trust claims from source immediately.',
|
|
2813
2837
|
agents: roster.debate_team.map((agent) => agent.id),
|
|
2814
2838
|
max_parallel_subagents: agentSessions,
|
|
2815
2839
|
write_policy: 'read-only'
|
|
2816
2840
|
},
|
|
2817
2841
|
{
|
|
2818
2842
|
id: 'consensus',
|
|
2819
|
-
goal: 'Parent orchestrator synthesizes one agreed objective, rejected alternatives, acceptance criteria, and parallel implementation slices.',
|
|
2843
|
+
goal: 'Parent orchestrator synthesizes one agreed objective, rejected alternatives, acceptance criteria, and parallel implementation slices, then refreshes/validates TriWiki before implementation handoff.',
|
|
2820
2844
|
agents: ['parent_orchestrator'],
|
|
2821
2845
|
output: 'agreed-objective.md'
|
|
2822
2846
|
},
|
|
@@ -2827,14 +2851,14 @@ function buildTeamPlan(id, prompt, opts = {}) {
|
|
|
2827
2851
|
},
|
|
2828
2852
|
{
|
|
2829
2853
|
id: 'parallel_implementation',
|
|
2830
|
-
goal: 'Fresh executor developers take disjoint write sets
|
|
2854
|
+
goal: 'Fresh executor developers read relevant TriWiki plus current source, take disjoint write sets, implement in parallel without reverting each other, and trigger refresh after implementation changes or blockers.',
|
|
2831
2855
|
agents: roster.development_team.map((agent) => agent.id),
|
|
2832
2856
|
max_parallel_subagents: agentSessions,
|
|
2833
2857
|
write_policy: 'workspace-write with explicit ownership'
|
|
2834
2858
|
},
|
|
2835
2859
|
{
|
|
2836
2860
|
id: 'review_and_integrate',
|
|
2837
|
-
goal: 'Strict reviewers check correctness, DB safety, tests, and evidence; user personas validate practical inconvenience; parent integrates final result.',
|
|
2861
|
+
goal: 'Strict reviewers read/validate current TriWiki context, check correctness, DB safety, tests, and evidence; user personas validate practical inconvenience; parent integrates final result and refreshes after review findings.',
|
|
2838
2862
|
agents: roster.validation_team.map((agent) => agent.id).concat(['parent_orchestrator'])
|
|
2839
2863
|
}
|
|
2840
2864
|
],
|
|
@@ -2843,13 +2867,13 @@ function buildTeamPlan(id, prompt, opts = {}) {
|
|
|
2843
2867
|
'Every useful subagent message, result, handoff, review finding, and integration decision is mirrored to team-live.md and team-transcript.jsonl.',
|
|
2844
2868
|
'Analysis scouts, debate team, and development team are separate bundles; scouts finish before debate and debate closes before implementation workers start.',
|
|
2845
2869
|
'Analysis scouts are read-only and maximize the available session budget for independent investigation before any code edit.',
|
|
2846
|
-
'The parent
|
|
2870
|
+
'The parent and agents use relevant TriWiki before every stage, hydrate low-trust claims from source during the stage, and refresh/validate TriWiki after scouting, debate, consensus, implementation, and review changes.',
|
|
2847
2871
|
'executor:N creates exactly N debate participants and then a separate N-person executor development team.',
|
|
2848
2872
|
'Final user personas should not be overly smart or cooperative; they represent stubborn, inconvenience-averse real users.',
|
|
2849
2873
|
'Planning agents do not edit files.',
|
|
2850
2874
|
'Implementation workers receive disjoint ownership scopes.',
|
|
2851
2875
|
'Workers are told they are not alone in the codebase and must not revert others edits.',
|
|
2852
|
-
'Context tracking uses TriWiki as the SSOT; team handoffs must preserve id, hash, source path, and RGBA/trig coordinate anchors.',
|
|
2876
|
+
'Context tracking uses TriWiki as the SSOT throughout the whole pipeline; team handoffs and final claims must preserve id, hash, source path, and RGBA/trig coordinate anchors.',
|
|
2853
2877
|
'SKS hooks, DB safety rules, Ralph no-question rules, and H-Proof gates remain active.',
|
|
2854
2878
|
'Destructive database operations remain forbidden.'
|
|
2855
2879
|
],
|
|
@@ -2886,7 +2910,7 @@ $Team ${plan.prompt}
|
|
|
2886
2910
|
|
|
2887
2911
|
Use high reasoning for the Team route only, then return to the default/user-selected profile after completion. Use at most ${plan.agent_session_count || 3} subagent sessions at a time; the parent orchestrator is not counted.
|
|
2888
2912
|
|
|
2889
|
-
First run exactly ${plan.roster.bundle_size} read-only analysis_scout_N agents in parallel. Split repo, docs, tests, API, DB risk, UX friction, and implementation-surface investigation into independent slices, then capture source-backed findings in team-analysis.md. Refresh and validate TriWiki before debate. Then run the debate team with exactly ${plan.roster.bundle_size} participants. Use the concrete roster below: final-user voices are stubborn and inconvenience-averse, executor voices are capable developers, reviewers are strict, and planners force consensus. Synthesize one agreed objective with acceptance criteria and disjoint implementation slices. Close the debate team. Then form a fresh development team with exactly ${plan.roster.bundle_size} executor_N developers implementing slices in parallel with non-overlapping ownership. Review with the validation team, integrate results in the parent thread, run verification, and report evidence.
|
|
2913
|
+
Before each stage, read the relevant TriWiki context pack and hydrate low-trust claims from source. First run exactly ${plan.roster.bundle_size} read-only analysis_scout_N agents in parallel. Split repo, docs, tests, API, DB risk, UX friction, and implementation-surface investigation into independent slices, then capture source-backed findings in team-analysis.md. Refresh and validate TriWiki before debate. Then run the debate team with exactly ${plan.roster.bundle_size} participants using the refreshed pack. Use the concrete roster below: final-user voices are stubborn and inconvenience-averse, executor voices are capable developers, reviewers are strict, and planners force consensus. Synthesize one agreed objective with acceptance criteria and disjoint implementation slices, then refresh and validate TriWiki again. Close the debate team. Then form a fresh development team with exactly ${plan.roster.bundle_size} executor_N developers implementing slices in parallel with non-overlapping ownership. Refresh TriWiki after implementation changes or blockers. Review with the validation team, validate TriWiki again, integrate results in the parent thread, run verification, and report evidence.
|
|
2890
2914
|
\`\`\`
|
|
2891
2915
|
|
|
2892
2916
|
## Session Budget
|
|
@@ -2904,7 +2928,7 @@ First run exactly ${plan.roster.bundle_size} read-only analysis_scout_N agents i
|
|
|
2904
2928
|
- Pack: ${ctx.default_pack}
|
|
2905
2929
|
- Refresh: \`${ctx.pack_command}\`
|
|
2906
2930
|
- Validate: \`${ctx.validate_command}\`
|
|
2907
|
-
- Rule:
|
|
2931
|
+
- Rule: use relevant TriWiki before every stage, hydrate low-trust claims during the stage, refresh after findings/artifact changes, validate before handoffs/final claims, and keep id, hash, source path, and RGBA/trig coordinate anchors hydratable.
|
|
2908
2932
|
|
|
2909
2933
|
## Analysis Scouts
|
|
2910
2934
|
|
|
@@ -2914,7 +2938,7 @@ Scout rules:
|
|
|
2914
2938
|
- Read-only only.
|
|
2915
2939
|
- Each scout owns one independent investigation slice.
|
|
2916
2940
|
- Return source paths, risks, claims, and suggested implementation slices in TriWiki-ready form.
|
|
2917
|
-
- Parent updates team-analysis.md, runs \`${ctx.pack_command}\`, then runs \`${ctx.validate_command}\` before debate/development.
|
|
2941
|
+
- Parent updates team-analysis.md, runs \`${ctx.refresh_command || ctx.pack_command}\` or \`${ctx.pack_command}\`, then runs \`${ctx.validate_command}\` before debate/development.
|
|
2918
2942
|
|
|
2919
2943
|
## Debate Team
|
|
2920
2944
|
|
package/src/core/fsx.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import os from 'node:os';
|
|
|
5
5
|
import crypto from 'node:crypto';
|
|
6
6
|
import { spawn } from 'node:child_process';
|
|
7
7
|
|
|
8
|
-
export const PACKAGE_VERSION = '0.6.
|
|
8
|
+
export const PACKAGE_VERSION = '0.6.30';
|
|
9
9
|
export const DEFAULT_PROCESS_TAIL_BYTES = 256 * 1024;
|
|
10
10
|
export const DEFAULT_PROCESS_TIMEOUT_MS = 30 * 60 * 1000;
|
|
11
11
|
|
|
@@ -424,13 +424,17 @@ function visibleHookMessage(name, text = '') {
|
|
|
424
424
|
if (name === 'user-prompt-submit') {
|
|
425
425
|
if (body.includes('DFix ultralight pipeline active')) return 'SKS: DFix ultralight task list injected.';
|
|
426
426
|
if (body.includes('SKS answer-only pipeline active')) return 'SKS: answer-only research context injected.';
|
|
427
|
+
if (body.includes('SKS wiki pipeline active')) return 'SKS: wiki refresh context injected.';
|
|
427
428
|
if (body.includes('MANDATORY $Ralph')) return 'SKS: Ralph clarification gate prepared in Codex App.';
|
|
428
429
|
if (body.includes('$Team route prepared') || body.includes('Team route')) return 'SKS: Team route, live transcript, and subagent plan injected.';
|
|
429
430
|
if (body.includes('Subagent policy: REQUIRED')) return 'SKS: route context injected; subagent execution gate is active.';
|
|
430
431
|
return 'SKS: skill-first route context injected.';
|
|
431
432
|
}
|
|
432
433
|
if (name === 'post-tool') return 'SKS: tool result inspected; Context7/subagent/DB evidence updated when relevant.';
|
|
433
|
-
if (name === 'stop')
|
|
434
|
+
if (name === 'stop') {
|
|
435
|
+
if (body.includes('Required questions')) return 'SKS: clarification questions reprinted; waiting for answers.';
|
|
436
|
+
return body ? 'SKS: stop gate checked; continuing until route evidence passes.' : 'SKS: stop gate checked.';
|
|
437
|
+
}
|
|
434
438
|
if (name === 'permission-request') return body ? 'SKS: permission request evaluated by harness guards.' : 'SKS: permission request inspected.';
|
|
435
439
|
if (name === 'pre-tool') return body ? 'SKS: tool call inspected by harness guards.' : 'SKS: tool call inspected.';
|
|
436
440
|
return 'SKS: hook evaluated.';
|
package/src/core/init.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { DEFAULT_DB_SAFETY_POLICY } from './db-safety.mjs';
|
|
|
6
6
|
import { isHarnessSourceProject, writeHarnessGuardPolicy } from './harness-guard.mjs';
|
|
7
7
|
import { repairSksGeneratedArtifacts } from './harness-conflicts.mjs';
|
|
8
8
|
import { installVersionGitHook } from './version-manager.mjs';
|
|
9
|
-
import { DOLLAR_COMMANDS, DOLLAR_COMMAND_ALIASES, DOLLAR_SKILL_NAMES, RECOMMENDED_MCP_SERVERS, RECOMMENDED_SKILLS, context7ConfigToml, triwikiContextTracking, triwikiContextTrackingText } from './routes.mjs';
|
|
9
|
+
import { DOLLAR_COMMANDS, DOLLAR_COMMAND_ALIASES, DOLLAR_SKILL_NAMES, RECOMMENDED_MCP_SERVERS, RECOMMENDED_SKILLS, context7ConfigToml, triwikiContextTracking, triwikiContextTrackingText, triwikiStagePolicyText } from './routes.mjs';
|
|
10
10
|
|
|
11
11
|
export function normalizeInstallScope(scope = 'global') {
|
|
12
12
|
const value = String(scope || 'global').trim().toLowerCase();
|
|
@@ -130,7 +130,7 @@ For open-ended improvement, discovery, prompt, evaluation, ranking, SEO/GEO, or
|
|
|
130
130
|
|
|
131
131
|
## Team Orchestration
|
|
132
132
|
|
|
133
|
-
When the user invokes Team mode or \`$Team\`, use Codex multi-agent/subagent orchestration as four ordered stages: parallel analysis scouts, TriWiki refresh, read-only debate team, and fresh parallel development team. Role counts use tokens like \`executor:5 reviewer:2 user:1\`; \`executor:N\` creates exactly N read-only \`analysis_scout_N\` agents first, exactly N debate participants next, and then a separate N-person \`executor_N\` development team. Analysis scouts split repo, docs, tests, API, DB-risk, UX-friction, and implementation-surface investigation into independent read-only slices. Scout findings must be source-backed and TriWiki-ready, then the parent refreshes and validates \`.sneakoscope/wiki/context-pack.json\` before debate
|
|
133
|
+
When the user invokes Team mode or \`$Team\`, use Codex multi-agent/subagent orchestration as four ordered stages: parallel analysis scouts, TriWiki refresh, read-only debate team, and fresh parallel development team. TriWiki is not a one-time setup step: before every stage, read relevant \`.sneakoscope/wiki/context-pack.json\` entries; during the stage, hydrate low-trust or stale claims from their source/hash/RGBA anchors; after scout findings, debate conclusions, consensus, implementation changes, reviews, or blockers, refresh or pack TriWiki; before every handoff and final claim, validate the pack. Role counts use tokens like \`executor:5 reviewer:2 user:1\`; \`executor:N\` creates exactly N read-only \`analysis_scout_N\` agents first, exactly N debate participants next, and then a separate N-person \`executor_N\` development team. Analysis scouts split repo, docs, tests, API, DB-risk, UX-friction, and implementation-surface investigation into independent read-only slices. Scout findings must be source-backed and TriWiki-ready, then the parent refreshes and validates \`.sneakoscope/wiki/context-pack.json\` before debate. The debate team is read-only and includes stubborn final-user personas, capable developer/executor voices, strict reviewers, and planners. Final users are intentionally low-context, self-interested, stubborn, and hostile to inconvenience. Reviewers are strict. Executors are capable developers. Close or stop debate agents once the objective is sealed, then refresh/validate TriWiki before implementation. Then form a fresh development team where executor_N developers implement disjoint slices in parallel and reviewers/user personas validate the result. The parent agent remains the orchestrator: it assigns ownership, watches hook output, waits only when blocked, integrates results, runs verification, and produces the final evidence. Record every useful scout finding, subagent status/result/handoff/review line in the Team live transcript with \`sks team event <mission-id|latest> --agent <name> --phase <phase> --message "..."\`; the user can inspect \`team-live.md\`, \`team-transcript.jsonl\`, or \`sks team watch latest\` instead of tmux. Do not let subagents make destructive database changes or bypass SKS hooks.
|
|
134
134
|
|
|
135
135
|
## Code-Changing Execution
|
|
136
136
|
|
|
@@ -158,7 +158,7 @@ When work depends on external libraries, frameworks, APIs, MCPs, package manager
|
|
|
158
158
|
|
|
159
159
|
## LLM Wiki Continuity
|
|
160
160
|
|
|
161
|
-
TriWiki is the context-tracking SSOT for long-running missions, Team handoffs, and context-pressure recovery. It is anchor-first, not lossy-summary-first. Important claims, visual nodes, policy facts, and evidence pointers should receive deterministic RGBA wiki coordinates: R maps to domain angle, G maps to layer radius through sine, B maps to phase angle, and A maps to concentration/confidence. Use those trigonometric coordinates to preserve stable retrieval anchors across turns. Selected claims may be pasted as text, but non-selected claims must remain hydratable through id, hash, source path, and RGBA coordinate anchors instead of disappearing from the workflow. Refresh with \`sks wiki pack\` and validate with \`sks wiki validate .sneakoscope/wiki/context-pack.json\` whenever route continuity or
|
|
161
|
+
TriWiki is the context-tracking SSOT for long-running missions, Team handoffs, and context-pressure recovery. It is anchor-first, not lossy-summary-first. Use relevant TriWiki context at every work stage, not only at the beginning: read the pack before a stage, hydrate low-trust claims during the stage, refresh after new findings or artifact changes, and validate before handoffs/final claims. Important claims, visual nodes, policy facts, and evidence pointers should receive deterministic RGBA wiki coordinates: R maps to domain angle, G maps to layer radius through sine, B maps to phase angle, and A maps to concentration/confidence. Use those trigonometric coordinates to preserve stable retrieval anchors across turns. Selected claims may be pasted as text, but non-selected claims must remain hydratable through id, hash, source path, and RGBA coordinate anchors instead of disappearing from the workflow. Refresh with \`sks wiki refresh\` or \`sks wiki pack\` and validate with \`sks wiki validate .sneakoscope/wiki/context-pack.json\` whenever route continuity, stage context, source evidence, or handoff context changes.
|
|
162
162
|
|
|
163
163
|
## Dollar Commands
|
|
164
164
|
|
|
@@ -600,7 +600,8 @@ The prompt optimization pipeline also runs without a dollar command and infers t
|
|
|
600
600
|
## Context Tracking
|
|
601
601
|
|
|
602
602
|
- ${triwikiContextTrackingText(commandPrefix)}
|
|
603
|
-
-
|
|
603
|
+
- ${triwikiStagePolicyText(commandPrefix).replace(/\n/g, '\n- ')}
|
|
604
|
+
- Team mode, Ralph continuations, Research/AutoResearch, DB reviews, and long-running implementation handoffs should use relevant TriWiki context during every stage instead of relying on one initial pack or ad hoc summaries.
|
|
604
605
|
|
|
605
606
|
## Code-Changing Execution
|
|
606
607
|
|
|
@@ -694,6 +695,9 @@ async function installSkills(root) {
|
|
|
694
695
|
'dfix': `---\nname: dfix\ndescription: Ultralight fast design/content fix mode for $DFix or $dfix requests and inferred simple edits such as text color, copy, labels, spacing, or translation.\n---\n\nYou are running SKS DFix mode.\n\nPurpose:\n- Bypass the general SKS prompt pipeline for small design/content requests.\n- Convert the request into a tiny task list, then execute only those tasks.\n- Use for requests like 글자 색 바꿔줘, 내용을 영어로 바꿔줘, button label 수정, spacing 조정, copy replacement, simple style tweaks.\n\nUltralight loop:\n1. List the exact micro-edits implied by the request.\n2. Inspect only the files needed to locate those targets.\n3. Apply only the listed edits.\n4. Run only cheap verification when useful.\n5. Final response should be short: what changed and any verification.\n\nRules:\n- Do not enter the general prompt pipeline, mission workflow, ambiguity gate, TriWiki refresh, Context7 routing, subagent orchestration, Ralph, Research, eval, or broad redesign.\n- Do not ask for more requirements when the target can be inferred from local context.\n- Preserve the existing design system and component patterns.\n`,
|
|
695
696
|
'answer': `---\nname: answer\ndescription: Answer-only research route for ordinary questions that should not start implementation.\n---\n\nUse when the user is asking for an explanation, comparison, status, facts, source-backed research, or documentation guidance rather than asking you to change files or run work.\n\nEvidence flow:\n1. Use current repo files and TriWiki first when the answer is project-local.\n2. Hydrate low-trust wiki claims from source paths before relying on them.\n3. Use web search for current, external, or uncertain facts when browsing is available or the user asks for latest/source-backed information.\n4. Use Context7 resolve-library-id plus query-docs when the answer depends on package, API, framework, SDK, MCP, or generated documentation behavior.\n5. End with Honest Mode fact-checking: separate verified facts, source-backed inferences, and uncertainty.\n\nRules:\n- Do not create route mission state, ambiguity-gate questions, subagents, Team handoffs, Ralph, Research loops, eval loops, or file edits.\n- If the prompt turns out to request implementation, state the reroute and use the proper execution pipeline.\n`,
|
|
696
697
|
'sks': `---\nname: sks\ndescription: General Sneakoscope Codex command route for $SKS or $sks usage, setup, status, and workflow help.\n---\n\nUse the local SKS control surface. Prefer these discovery commands when the user asks what is available: sks commands, sks usage <topic>, sks quickstart, sks codex-app, sks context7 check, sks guard check, sks conflicts check, sks reasoning, sks wiki pack, and sks pipeline status. If implementation is requested, route to the lightest matching SKS path and keep reasoning-profile changes temporary. For code-changing execution, first surface route/guard/write-scope status, then use worker subagents by default when scopes are independent; the parent integrates and verifies, while urgent blocking work stays local. Context tracking uses TriWiki as the SSOT for long-running or cross-turn work. Do not edit installed harness control files; the harness guard blocks LLM writes after setup except in the Sneakoscope engine source repo. If OMX/DCodex or another explicit Codex harness is detected, do not install SKS; use sks conflicts prompt and require human approval before cleanup.\n`,
|
|
698
|
+
'wiki': `---\nname: wiki\ndescription: Dollar-command route for $Wiki TriWiki refresh, pack, validate, and prune commands.\n---\n\nUse for $Wiki/$WikiRefresh or Korean wiki-refresh requests. Refresh/update/갱신: run sks wiki refresh, then validate .sneakoscope/wiki/context-pack.json. Pack: run sks wiki pack, then validate. Prune/clean/정리: use sks wiki refresh --prune, or sks wiki prune --dry-run for inspection. Report claims, anchors, trust, validation, and blockers. Do not start ambiguity-gated implementation, subagents, or unrelated work.\n`,
|
|
699
|
+
'wiki-refresh': `---\nname: wiki-refresh\ndescription: Codex App picker alias for $WikiRefresh.\n---\n\nUse exactly like $Wiki.\n`,
|
|
700
|
+
'wikirefresh': `---\nname: wikirefresh\ndescription: Compact Codex App picker alias for $WikiRefresh.\n---\n\nUse exactly like $Wiki.\n`,
|
|
697
701
|
'team': `---\nname: team\ndescription: Dollar-command route for $Team or $team SKS Team multi-agent orchestration: mandatory ambiguity gate, parallel analysis scouts, TriWiki refresh, role-counted debate, fresh executor development team, live transcript, and final integration.\n---\n\nUse when the user invokes $Team/$team, asks for a team of agents, or asks for parallel specialist implementation.\n\nWorkflow:\n1. Mandatory ambiguity-removal gate: before any scout/debate/implementation work, ask the generated questions, write answers.json, and run sks pipeline answer latest answers.json. Do not spawn analysis scouts until this gate passes.\n2. Create or inspect the Team mission with sks team \"task\" when useful. Role counts use executor:5 reviewer:2 user:1 planner:1. executor:N means exactly N analysis_scout_N agents first, exactly N debate participants next, and then a separate N-person executor development team. --agents N, --sessions N, and --team-size N remain aliases for executor/session budget; --max-agents uses the configured default maximum of 6 sessions/agents; default is executor:3 reviewer:1 user:1 planner:1.\n3. Parallel analysis scouts: spawn the concrete analysis_scout_N roster read-only. Split repo, docs, tests, API, DB-risk, UX-friction, and implementation-surface investigation into independent slices. Each scout returns source-backed findings for team-analysis.md.\n4. TriWiki refresh: parent turns scout findings into TriWiki-ready claims, runs sks wiki pack, then runs sks wiki validate .sneakoscope/wiki/context-pack.json. Do not move to debate or implementation until the pack is refreshed and validated.\n5. Debate bundle: spawn the concrete debate_team roster using the refreshed TriWiki context. Users are intentionally low-context, self-interested, stubborn, and inconvenience-averse. Executor voices are capable developers. Reviewers are strict. Planners force one coherent objective.\n6. Live visibility phase: after every useful scout finding, subagent status/result/handoff, record it with sks team event <mission-id|latest> --agent <name> --phase <phase> --message \"...\" so the user can see the team conversation without tmux.\n7. Consensus phase: synthesize debate into one objective, explicit constraints, acceptance criteria, and disjoint implementation slices.\n8. Close or stop the debate team after their results are captured.\n9. Development bundle: form a fresh development_team where exactly executor_N developers implement slices in parallel with non-overlapping ownership. Tell workers they are not alone in the codebase and must not revert others' edits.\n10. Review phase: validation_team reviewers check correctness, DB safety, missing tests, and evidence; user personas reject outcomes that create practical friction.\n11. Verification phase: run focused tests or justify gaps, update mission artifacts when present, and produce final evidence.\n\nLive files:\n- .sneakoscope/missions/<id>/team-analysis.md stores source-backed scout findings and TriWiki-ready claims.\n- .sneakoscope/missions/<id>/team-live.md is the user-readable live transcript inside Codex App.\n- .sneakoscope/missions/<id>/team-transcript.jsonl is the machine-readable event stream.\n- .sneakoscope/missions/<id>/team-dashboard.json is the current dashboard.\n\nRules:\n- The parent agent remains orchestrator and owns final integration.\n- Before spawning development workers, surface visible SKS route, guard, write-scope, TriWiki, and verification status.\n- Do not delegate the immediate blocking task when the parent can do it faster.\n- Use high reasoning only while the Team route is active, then return to the default/user-selected profile.\n- Never let subagents bypass SKS hooks, DB safety, no-question Ralph rules, or H-Proof completion gates.\n- Destructive database actions remain forbidden.\n`,
|
|
698
702
|
'agent-team': `---\nname: agent-team\ndescription: Fallback Codex App picker alias for $Team/$team when the app hides or reserves the plain team skill name.\n---\n\nUse exactly like $Team. This skill exists so npm install, sks setup, and sks doctor --fix can repair Codex App discovery when the plain \`team\` skill file exists but does not appear in the picker.\n\nRoute:\n- Treat $agent-team as $Team.\n- Create or inspect the Team mission with sks team \"task\" when useful.\n- Follow the same scout-first Team orchestration protocol: parallel analysis scouts, TriWiki refresh and validation, read-only debate, one sealed objective, fresh executor_N implementation team, strict review, and final evidence.\n- Record live progress with sks team event <mission-id|latest> --agent <name> --phase <phase> --message \"...\".\n\nRules:\n- The parent agent remains orchestrator and owns final integration.\n- Never let subagents bypass SKS hooks, DB safety, no-question Ralph rules, Context7 gates, or H-Proof/Honest Mode.\n- Destructive database actions remain forbidden.\n`,
|
|
699
703
|
'ralph': `---\nname: ralph\ndescription: Dollar-command route for $Ralph or $ralph mandatory clarification and no-question mission workflows.\n---\n\nUse when the user invokes $Ralph/$ralph or requests a clarification-gated autonomous implementation mission. Prepare with sks ralph prepare, answer/seal required slots when answers are provided, then run only after decision-contract.json exists.\n`,
|
|
@@ -702,9 +706,9 @@ async function installSkills(root) {
|
|
|
702
706
|
'db': `---\nname: db\ndescription: Dollar-command route for $DB or $db database and Supabase safety checks.\n---\n\nUse when the user invokes $DB/$db or the task touches SQL, Supabase, Postgres, migrations, Prisma, Drizzle, Knex, MCP database tools, or production data. Run or follow sks db policy, sks db scan, sks db classify, and sks db check. Destructive database operations remain forbidden.\n`,
|
|
703
707
|
'gx': `---\nname: gx\ndescription: Dollar-command route for $GX or $gx deterministic GX visual context cartridges.\n---\n\nUse when the user invokes $GX/$gx or asks for architecture/context visualization through SKS. Prefer sks gx init, render, validate, drift, and snapshot. vgraph.json remains the source of truth.\n`,
|
|
704
708
|
'help': `---\nname: help\ndescription: Dollar-command route for $Help or $help explaining installed SKS commands and workflows.\n---\n\nUse when the user invokes $Help/$help or asks what commands exist. Prefer concise output from sks commands, sks usage <topic>, sks quickstart, sks aliases, and sks codex-app.\n`,
|
|
705
|
-
'prompt-pipeline': `---\nname: prompt-pipeline\ndescription: Default SKS prompt optimization pipeline for execution prompts; Answer and DFix bypass it.\n---\n\nEvery prompt starts with intent classification. If it is answer-only, use the Answer path: TriWiki when relevant, web for current or external facts, Context7 for package/API/framework docs, Honest Mode fact-checking, then direct reply. If it is DFix, use the ultralight task-list path.\n\nFor execution prompts, aggressively infer intent from rough wording, local context, repo conventions, current route state, and prior artifacts. The stance is: understand the likely goal without making the user over-specify. Every execution route must start with the mandatory ambiguity-removal gate before execution.\n\nAsk the generated ambiguity-removal questions at the start, write answers.json after the user answers, and seal the gate with sks pipeline answer latest answers.json. Ralph may use sks ralph answer latest answers.json. Do not execute route work, spawn Team scouts, run DB changes, or implement code before the gate passes.\n\nExtract intent, target surface, constraints, acceptance criteria, risk level, and the smallest safe route. Infer $Answer for ordinary questions, $DFix for simple design/content edits, Ralph for no-question autonomous execution, Research only for frontier discovery work, DB only for database-risk work, GX only for visual context artifacts, and eval only when performance or context-quality claims need evidence.\n\nFor code-changing execution, first surface visible SKS status context: route, guard state, affected write scopes, and verification plan. Default to worker subagents when the work can be split into independent, non-overlapping write scopes. The parent keeps urgent blocking work local, assigns ownership, integrates results, verifies, and preserves DB safety, harness guard, Ralph, Context7, and H-Proof/Honest Mode gates.\n\nContext continuity:\n- Prefer TriWiki coordinate context packs over ad hoc summaries
|
|
709
|
+
'prompt-pipeline': `---\nname: prompt-pipeline\ndescription: Default SKS prompt optimization pipeline for execution prompts; Answer and DFix bypass it.\n---\n\nEvery prompt starts with intent classification. If it is answer-only, use the Answer path: TriWiki when relevant, web for current or external facts, Context7 for package/API/framework docs, Honest Mode fact-checking, then direct reply. If it is DFix, use the ultralight task-list path.\n\nFor execution prompts, aggressively infer intent from rough wording, local context, repo conventions, current route state, and prior artifacts. The stance is: understand the likely goal without making the user over-specify. Every execution route must start with the mandatory ambiguity-removal gate before execution.\n\nAsk the generated ambiguity-removal questions at the start, write answers.json after the user answers, and seal the gate with sks pipeline answer latest answers.json. Ralph may use sks ralph answer latest answers.json. Do not execute route work, spawn Team scouts, run DB changes, or implement code before the gate passes.\n\nExtract intent, target surface, constraints, acceptance criteria, risk level, and the smallest safe route. Infer $Answer for ordinary questions, $DFix for simple design/content edits, Ralph for no-question autonomous execution, Research only for frontier discovery work, DB only for database-risk work, GX only for visual context artifacts, and eval only when performance or context-quality claims need evidence.\n\nFor code-changing execution, first surface visible SKS status context: route, guard state, affected write scopes, and verification plan. Default to worker subagents when the work can be split into independent, non-overlapping write scopes. The parent keeps urgent blocking work local, assigns ownership, integrates results, verifies, and preserves DB safety, harness guard, Ralph, Context7, and H-Proof/Honest Mode gates.\n\nContext continuity:\n- Prefer TriWiki coordinate context packs over ad hoc summaries whenever route continuity matters.\n- Use relevant TriWiki context before every route stage, not only at initial setup.\n- Hydrate low-trust or stale wiki claims from their source path/hash/RGBA anchor during the stage before relying on them.\n- Run \`sks wiki refresh\` or \`sks wiki pack\` after new findings, changed artifacts, scout results, debate conclusions, implementation changes, reviews, or blockers.\n- Validate with \`sks wiki validate .sneakoscope/wiki/context-pack.json\` before handoffs and final claims.\n- Treat RGBA wiki anchors as hydratable pointers: selected text is only the visible slice; non-selected claims remain recoverable by id, hash, source path, and trigonometric coordinate.\n`,
|
|
706
710
|
'reasoning-router': `---\nname: reasoning-router\ndescription: Temporary SKS reasoning-effort routing for every command and pipeline route.\n---\n\nUse medium for simple fulfillment such as copy, color, command discovery, setup display, or mechanical edits. Use high for any logical, safety, architecture, database, orchestration, refactor, or multi-file implementation work. Use xhigh for research, AutoResearch, hypotheses, falsification, benchmarks, SEO/GEO experiments, and open-ended discovery.\n\nRules:\n- Treat the routing as temporary for the current route only.\n- Do not persist profile changes.\n- Return to the default or user-selected profile when the route gate passes.\n- Inspect with sks reasoning \"prompt\" and sks pipeline status.\n`,
|
|
707
|
-
'pipeline-runner': `---\nname: pipeline-runner\ndescription: Execute SKS dollar-command routes as stateful pipelines with mission artifacts, route gates, Context7 evidence, temporary reasoning routing, and Honest Mode.\n---\n\nEvery $ command is a route, not decorative context. Use the active route state in .sneakoscope/state/current.json, write route artifacts under .sneakoscope/missions/<id>/, and do not finish until the route stop gate passes or a hard blocker is recorded with evidence.\n\nAtomic loop:\n1. Load the route skill and required supporting skills.\n2. Apply temporary reasoning routing: medium for simple work, high for logical work, xhigh for research.\n3. Before code edits, surface visible SKS route/guard/write-scope status, then spawn worker subagents by default for independent write scopes; keep immediate blockers local.\
|
|
711
|
+
'pipeline-runner': `---\nname: pipeline-runner\ndescription: Execute SKS dollar-command routes as stateful pipelines with mission artifacts, route gates, Context7 evidence, temporary reasoning routing, and Honest Mode.\n---\n\nEvery $ command is a route, not decorative context. Use the active route state in .sneakoscope/state/current.json, write route artifacts under .sneakoscope/missions/<id>/, and do not finish until the route stop gate passes or a hard blocker is recorded with evidence.\n\nAtomic loop:\n1. Load the route skill and required supporting skills.\n2. Apply temporary reasoning routing: medium for simple work, high for logical work, xhigh for research.\n3. Before each route stage, read relevant TriWiki context from .sneakoscope/wiki/context-pack.json and hydrate low-trust claims from source before relying on them.\n4. Before code edits, surface visible SKS route/guard/write-scope status, then spawn worker subagents by default for independent write scopes; keep immediate blockers local.\n5. Execute exactly the next useful atomic action.\n6. Record evidence in the mission artifact named by the route, then refresh or pack TriWiki when new findings/artifact changes should affect later stages.\n7. Respect harness self-protection: never edit installed SKS control files, generated skills, hooks, policy, AGENTS.md, or node_modules/sneakoscope from an LLM tool call.\n8. Re-check Context7 evidence when required.\n9. Validate TriWiki before handoffs/final claims, re-check the stop gate before final output, and return to the default profile.\n\nUse \`sks pipeline status\` for the current route and \`sks pipeline resume\` for the next action hint.\n`,
|
|
708
712
|
'context7-docs': `---\nname: context7-docs\ndescription: Enforce Context7 MCP documentation evidence for SKS routes that depend on external libraries, frameworks, APIs, MCPs, package managers, DB SDKs, or generated docs.\n---\n\nWhen Context7 is required:\n- Use Context7 resolve-library-id for the relevant package/API.\n- Then use Context7 query-docs for the resolved id. Legacy Context7 get-library-docs evidence is also accepted.\n- Prefer the local stdio MCP path: sks context7 tools, sks context7 resolve, sks context7 docs, or sks context7 evidence.\n- Let SKS PostToolUse record both events in context7-evidence.jsonl.\n- Do not mark the route complete until both stages are present.\n\nCheck project setup with \`sks context7 check\`. The default project-local MCP lives in .codex/config.toml as npx -y @upstash/context7-mcp@latest.\n`,
|
|
709
713
|
'seo-geo-optimizer': `---\nname: seo-geo-optimizer\ndescription: SEO/GEO support for README, npm, GitHub, keywords, snippets, schema, and AI-search visibility.\n---\n\nUse for SEO, GEO, GitHub stars, npm discoverability/downloads, package keywords, README ranking, AI search, schema markup, or search snippets.\n\nRules:\n- Load Context7 first when package, npm, GitHub, framework, API, or generated-doc behavior matters.\n- Optimize concrete surfaces: README, package.json, docs, badges, npm metadata, GitHub topics, quickstart, examples, and command discovery.\n- Improve exact package name, command name, audience, use cases, keywords, install path, AI Answer Snapshot, and supportable examples.\n- Do not invent downloads, stars, benchmarks, compatibility, or ranking impact.\n- Route SEO/GEO work through $AutoResearch unless it is only a tiny copy edit.\n`,
|
|
710
714
|
'honest-mode': `---\nname: honest-mode\ndescription: Required final SKS verification pass before claiming a task is complete.\n---\n\nUse before every final answer.\n\nChecklist:\n- Restate the actual user goal in one sentence.\n- Verify the implemented result against that goal.\n- List tests, commands, screenshots, or inspections that prove it.\n- State any missing verification, uncertainty, or hard blocker plainly.\n- Do not claim complete if the evidence does not support it.\n- If implementation was requested, do not stop at a plan.\n\nThe final response should include a concise SKS Honest Mode or 솔직모드 note when the hook requires it.\n`,
|
|
@@ -733,7 +737,7 @@ async function installSkills(root) {
|
|
|
733
737
|
}
|
|
734
738
|
|
|
735
739
|
function enrichSkillContent(name, content) {
|
|
736
|
-
if (!['sks', 'answer', 'team', 'agent-team', 'ralph', 'research', 'autoresearch', 'db', 'gx', 'prompt-pipeline', 'pipeline-runner', 'turbo-context-pack', 'hproof-evidence-bind'].includes(name)) return content;
|
|
740
|
+
if (!['sks', 'answer', 'wiki', 'wiki-refresh', 'wikirefresh', 'team', 'agent-team', 'ralph', 'research', 'autoresearch', 'db', 'gx', 'prompt-pipeline', 'pipeline-runner', 'turbo-context-pack', 'hproof-evidence-bind'].includes(name)) return content;
|
|
737
741
|
const text = String(content || '').trimEnd();
|
|
738
742
|
if (text.includes('TriWiki context-tracking SSOT')) return text;
|
|
739
743
|
return `${text}
|
|
@@ -741,7 +745,7 @@ function enrichSkillContent(name, content) {
|
|
|
741
745
|
Context tracking:
|
|
742
746
|
- Mandatory ambiguity-removal happens before execution routes. Answer-only prompts use TriWiki/web/Context7 evidence and Honest Mode fact-checking without starting implementation. DFix bypasses this pipeline and uses its own ultralight task-list path. Ask the generated questions first, then seal answers with sks pipeline answer latest answers.json before implementing or spawning Team agents.
|
|
743
747
|
- TriWiki context-tracking SSOT is .sneakoscope/wiki/context-pack.json.
|
|
744
|
-
- Use sks wiki refresh or sks wiki pack when
|
|
748
|
+
- Use sks wiki refresh or sks wiki pack before each work stage when relevant, after new findings/artifact changes, and before handoffs or final claims.
|
|
745
749
|
- Use sks wiki prune when stale or oversized wiki state would pollute handoffs.
|
|
746
750
|
- Validate with sks wiki validate .sneakoscope/wiki/context-pack.json before relying on a refreshed pack.
|
|
747
751
|
- Selected text is only the visible slice; keep non-selected claims hydratable by id, hash, source path, and RGBA/trig coordinate.
|
package/src/core/pipeline.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { createMission, missionDir, setCurrent } from './mission.mjs';
|
|
|
5
5
|
import { buildQuestionSchema, writeQuestions } from './questions.mjs';
|
|
6
6
|
import { scanDbSafety } from './db-safety.mjs';
|
|
7
7
|
import { writeResearchPlan } from './research.mjs';
|
|
8
|
-
import { context7RequirementText, dollarCommand, reasoningInstruction, routeNeedsContext7, routePrompt, routeReasoning, routeRequiresSubagents, stripDollarCommand, subagentExecutionPolicyText, triwikiContextTracking, triwikiContextTrackingText } from './routes.mjs';
|
|
8
|
+
import { context7RequirementText, dollarCommand, reasoningInstruction, routeNeedsContext7, routePrompt, routeReasoning, routeRequiresSubagents, stripDollarCommand, subagentExecutionPolicyText, triwikiContextTracking, triwikiContextTrackingText, triwikiStagePolicyText } from './routes.mjs';
|
|
9
9
|
import { formatRoleCounts, initTeamLive, parseTeamSpecText } from './team-live.mjs';
|
|
10
10
|
|
|
11
11
|
export { routePrompt };
|
|
@@ -26,6 +26,7 @@ export function promptPipelineContext(prompt, route = routePrompt(prompt)) {
|
|
|
26
26
|
'Stance: infer the user intent aggressively from rough wording and local context, but ask short ambiguity-removal questions before work when a missing answer can change the target, scope, safety boundary, or acceptance criteria.',
|
|
27
27
|
subagentExecutionPolicyText(route, prompt),
|
|
28
28
|
triwikiContextTrackingText(),
|
|
29
|
+
triwikiStagePolicyText(),
|
|
29
30
|
'Extract intent, target files/surfaces, constraints, acceptance criteria, risks, and the smallest safe atomic step before acting.',
|
|
30
31
|
'Do not stop at a plan when implementation was requested; continue until the route gate passes or a hard blocker is honestly recorded.',
|
|
31
32
|
context7RequirementText(required),
|
|
@@ -79,6 +80,7 @@ export async function prepareRoute(root, prompt, state = {}) {
|
|
|
79
80
|
if (!route) return { route: null, additionalContext: promptPipelineContext(prompt, null) };
|
|
80
81
|
if (route.id === 'DFix') return prepareDfixQuickRoute(route, task);
|
|
81
82
|
if (route.id === 'Answer') return prepareAnswerOnlyRoute(route, task);
|
|
83
|
+
if (route.id === 'Wiki') return prepareWikiQuickRoute(route, task);
|
|
82
84
|
const required = routeNeedsContext7(route, prompt);
|
|
83
85
|
const reasoning = routeReasoning(route, prompt);
|
|
84
86
|
const subagentsRequired = routeRequiresSubagents(route, prompt);
|
|
@@ -110,20 +112,32 @@ async function prepareAnswerOnlyRoute(route, task) {
|
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
async function prepareWikiQuickRoute(route, task) {
|
|
116
|
+
return {
|
|
117
|
+
route,
|
|
118
|
+
additionalContext: [
|
|
119
|
+
`SKS wiki pipeline active. Route: ${route.command} (${route.route}).`,
|
|
120
|
+
`Task: ${task || 'refresh and validate TriWiki'}`,
|
|
121
|
+
'Run policy: refresh/update/갱신 -> `sks wiki refresh` then validate; prune/clean/정리 -> `sks wiki refresh --prune` or dry-run prune first; pack -> `sks wiki pack` then validate.',
|
|
122
|
+
'Report claims, anchors, trust, validation, and blockers. Do not create mission state, ask ambiguity-gate questions, spawn subagents, or run unrelated work.'
|
|
123
|
+
].join('\n')
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
113
127
|
export async function activeRouteContext(root, state) {
|
|
114
128
|
if (!state?.route && !state?.mode) return '';
|
|
115
129
|
const id = state.route || state.mode;
|
|
116
130
|
const reasoningNote = state.reasoning_effort ? ` Temporary reasoning remains ${state.reasoning_effort} (${state.reasoning_profile}); return to the default profile after this route completes.` : '';
|
|
117
131
|
if (state.clarification_required && String(state.phase || '').includes('CLARIFICATION_AWAITING_ANSWERS')) return clarificationAwaitingAnswersContext(root, state);
|
|
118
132
|
if (state.clarification_passed && String(state.phase || '').includes('CLARIFICATION_CONTRACT_SEALED')) {
|
|
119
|
-
return `Mandatory ambiguity-removal gate passed for ${state.route_command || state.route || state.mode}. Use the sealed decision-contract.json before executing the route. Next atomic action: continue the original route lifecycle with the clarified goal, constraints, non-goals, risk boundary, and test scope.`;
|
|
133
|
+
return `Mandatory ambiguity-removal gate passed for ${state.route_command || state.route || state.mode}. Use the sealed decision-contract.json before executing the route. Before the next route phase, read relevant TriWiki context, hydrate low-trust claims from source, and refresh/validate TriWiki again after new findings or artifact changes. Next atomic action: continue the original route lifecycle with the clarified goal, constraints, non-goals, risk boundary, and test scope.`;
|
|
120
134
|
}
|
|
121
135
|
if (state.mode === 'TEAM') {
|
|
122
136
|
const context7 = state.context7_required && !(await hasContext7DocsEvidence(root, state))
|
|
123
137
|
? ' Context7 evidence is still required before completion: use resolve-library-id, then query-docs (or legacy get-library-docs).'
|
|
124
138
|
: '';
|
|
125
139
|
const roles = state.role_counts ? ` Role counts: ${formatRoleCounts(state.role_counts)}.` : '';
|
|
126
|
-
return `Active Team mission ${state.mission_id || 'latest'} must keep the user-visible live transcript updated. Agent session budget: ${state.agent_sessions || 3}.${roles} Run parallel analysis scouts first, refresh and validate TriWiki, run debate team, close it, then start the fresh parallel development team. Context tracking uses TriWiki as SSOT
|
|
140
|
+
return `Active Team mission ${state.mission_id || 'latest'} must keep the user-visible live transcript updated. Agent session budget: ${state.agent_sessions || 3}.${roles} Run parallel analysis scouts first, refresh and validate TriWiki, run debate team, close it, then start the fresh parallel development team. Context tracking uses TriWiki as SSOT at every work stage: read relevant pack entries before each phase, hydrate low-trust claims during the phase, refresh after scout/debate/development/review changes, validate before every handoff and final claim, and prune with sks wiki prune when stale or oversized wiki state would pollute handoffs. Follow high-trust claims unless current source evidence contradicts them. Hooks can inject route context/status, but not arbitrary live chat bubbles. After each subagent status/result/handoff, run: sks team event ${state.mission_id || 'latest'} --agent <name> --phase <phase> --message "...". The user can inspect it with sks team log ${state.mission_id || 'latest'} or sks team watch ${state.mission_id || 'latest'}.${reasoningNote}${context7}`;
|
|
127
141
|
}
|
|
128
142
|
if (state.subagents_required && !(await hasSubagentEvidence(root, state))) {
|
|
129
143
|
return `Active SKS route ${id} requires subagent execution evidence before code-changing work can be considered complete. Spawn worker/reviewer subagents for disjoint write scopes, or record an explicit unavailable/unsplittable subagent evidence event before editing.${reasoningNote}`;
|
|
@@ -186,19 +200,19 @@ async function prepareTeam(root, route, task, required) {
|
|
|
186
200
|
bundle_size: roster.bundle_size,
|
|
187
201
|
roster,
|
|
188
202
|
team_model: {
|
|
189
|
-
phases: ['parallel_analysis_scouts', '
|
|
203
|
+
phases: ['parallel_analysis_scouts', 'triwiki_stage_refresh', 'debate_team', 'triwiki_stage_refresh', 'development_team', 'triwiki_stage_refresh', 'review'],
|
|
190
204
|
analysis_team: `Read-only parallel scouting with exactly ${roster.bundle_size} analysis_scout_N agents. Each scout owns one investigation slice and returns TriWiki-ready findings with source paths, risks, and suggested implementation slices.`,
|
|
191
205
|
debate_team: `Read-only role debate with exactly ${roster.bundle_size} participants composed from user, planner, reviewer, and executor voices.`,
|
|
192
206
|
development_team: `Fresh parallel development bundle with exactly ${roster.bundle_size} executor_N developers implementing disjoint slices; validation_team reviews afterward.`
|
|
193
207
|
},
|
|
194
208
|
context_tracking: triwikiContextTracking(),
|
|
195
209
|
phases: [
|
|
196
|
-
{ id: 'parallel_analysis_scouting', goal: `Spawn exactly ${roster.bundle_size} read-only analysis_scout_N agents in parallel, using the full available session budget without exceeding ${agentSessions}. Split repo/docs/tests/API/user-flow/risk investigation into independent slices and record source-backed findings.`, agents: roster.analysis_team.map((agent) => agent.id), max_parallel_subagents: agentSessions, write_policy: 'read-only' },
|
|
197
|
-
{ id: 'triwiki_refresh', goal: `Parent orchestrator updates Team analysis artifacts, then runs ${triwikiContextTracking().refresh_command} or ${triwikiContextTracking().pack_command}, prunes with ${triwikiContextTracking().prune_command} when stale/oversized wiki state would pollute handoffs, and runs ${triwikiContextTracking().validate_command} so
|
|
198
|
-
{ id: 'planning_debate', goal: `Debate team of exactly ${roster.bundle_size} participants maps user inconvenience, options, constraints, affected files, DB/test risk, and tradeoffs
|
|
199
|
-
{ id: 'consensus', goal:
|
|
200
|
-
{ id: 'parallel_implementation', goal: `Close debate agents, then spawn a fresh ${roster.bundle_size}-person executor development team with non-overlapping write ownership.`, agents: roster.development_team.map((agent) => agent.id) },
|
|
201
|
-
{ id: 'review_integration', goal: '
|
|
210
|
+
{ id: 'parallel_analysis_scouting', goal: `Before scouting, read relevant TriWiki context. Spawn exactly ${roster.bundle_size} read-only analysis_scout_N agents in parallel, using the full available session budget without exceeding ${agentSessions}. Split repo/docs/tests/API/user-flow/risk investigation into independent slices, hydrate relevant low-trust claims from source, and record source-backed findings.`, agents: roster.analysis_team.map((agent) => agent.id), max_parallel_subagents: agentSessions, write_policy: 'read-only' },
|
|
211
|
+
{ id: 'triwiki_refresh', goal: `Parent orchestrator updates Team analysis artifacts, then runs ${triwikiContextTracking().refresh_command} or ${triwikiContextTracking().pack_command}, prunes with ${triwikiContextTracking().prune_command} when stale/oversized wiki state would pollute handoffs, and runs ${triwikiContextTracking().validate_command} so the next stage uses current TriWiki context.`, agents: ['parent_orchestrator'], output: '.sneakoscope/wiki/context-pack.json' },
|
|
212
|
+
{ id: 'planning_debate', goal: `Before debate, read the refreshed TriWiki pack. Debate team of exactly ${roster.bundle_size} participants maps user inconvenience, options, constraints, affected files, DB/test risk, and tradeoffs while hydrating low-trust claims from source.`, agents: roster.debate_team.map((agent) => agent.id) },
|
|
213
|
+
{ id: 'consensus', goal: `Seal one objective with acceptance criteria and disjoint implementation slices, then refresh/validate TriWiki so implementation receives current consensus context.` },
|
|
214
|
+
{ id: 'parallel_implementation', goal: `Before implementation, read relevant TriWiki context and current source. Close debate agents, then spawn a fresh ${roster.bundle_size}-person executor development team with non-overlapping write ownership. Refresh TriWiki after implementation changes or blockers.`, agents: roster.development_team.map((agent) => agent.id) },
|
|
215
|
+
{ id: 'review_integration', goal: 'Before review and final output, read/validate current TriWiki context, integrate executor output, strict review correctness/DB safety/tests, validate user friction with validation_team, refresh after review findings, and record evidence.', agents: roster.validation_team.map((agent) => agent.id) }
|
|
202
216
|
],
|
|
203
217
|
live_visibility: {
|
|
204
218
|
markdown: 'team-live.md',
|
|
@@ -210,11 +224,11 @@ async function prepareTeam(root, route, task, required) {
|
|
|
210
224
|
};
|
|
211
225
|
await writeJsonAtomic(path.join(dir, 'team-plan.json'), plan);
|
|
212
226
|
const contextTracking = triwikiContextTracking();
|
|
213
|
-
await writeTextAtomic(path.join(dir, 'team-workflow.md'), `# SKS Team Workflow\n\nTask: ${cleanTask}\n\nAgent session budget: ${agentSessions}\nBundle size: ${roster.bundle_size}\nRole counts: ${formatRoleCounts(roleCounts)}\nReasoning: high for team logic, temporary for this route only.\nContext tracking: ${contextTracking.ssot} SSOT, ${contextTracking.default_pack}; refresh with "${contextTracking.refresh_command}" or "${contextTracking.pack_command}", prune with "${contextTracking.prune_command}" when stale/oversized wiki state would pollute handoffs, and validate with "${contextTracking.validate_command}". Follow high-trust claims
|
|
227
|
+
await writeTextAtomic(path.join(dir, 'team-workflow.md'), `# SKS Team Workflow\n\nTask: ${cleanTask}\n\nAgent session budget: ${agentSessions}\nBundle size: ${roster.bundle_size}\nRole counts: ${formatRoleCounts(roleCounts)}\nReasoning: high for team logic, temporary for this route only.\nContext tracking: ${contextTracking.ssot} SSOT, ${contextTracking.default_pack}; use relevant TriWiki context before every work stage, hydrate low-trust claims during the stage, refresh with "${contextTracking.refresh_command}" or "${contextTracking.pack_command}" after new findings/artifact changes, prune with "${contextTracking.prune_command}" when stale/oversized wiki state would pollute handoffs, and validate with "${contextTracking.validate_command}" before handoffs and final claims. Follow high-trust claims unless current source evidence contradicts them.\n\n1. Parallel analysis scouts: read relevant TriWiki first, then spawn exactly ${roster.bundle_size} analysis_scout_N read-only agents to investigate independent repo/docs/tests/API/user-flow/risk slices and write source-backed findings into team-analysis.md.\n2. TriWiki refresh: parent orchestrator updates/refreshes ${contextTracking.default_pack} with "${contextTracking.refresh_command}" or "${contextTracking.pack_command}", prunes with "${contextTracking.prune_command}" when needed, and validates it with "${contextTracking.validate_command}" before debate.\n3. Debate team of exactly ${roster.bundle_size} participants maps options, stubborn user friction, and risks using the refreshed TriWiki context; hydrate low-trust claims immediately from source.\n4. Consensus artifact seals one objective and implementation slices; refresh/validate TriWiki again before implementation handoff.\n5. Debate agents are closed.\n6. Fresh development team of exactly ${roster.bundle_size} executor_N developers reads relevant TriWiki plus current source, executes slices in parallel with at most ${agentSessions} subagent sessions at a time, and triggers refresh after implementation changes or blockers.\n7. Every useful subagent status, scout finding, debate result, handoff, review finding, and integration decision is mirrored to team-live.md and team-transcript.jsonl.\n8. Strict review, user-acceptance friction check, final TriWiki validation, and integration evidence are recorded.\n\nLive visibility:\n- Hooks can show route/status/done-gate digests, but they cannot create arbitrary live chat bubbles.\n- sks team log ${id}\n- sks team tail ${id}\n- sks team watch ${id}\n- sks team event ${id} --agent <name> --phase <phase> --message \"...\"\n`);
|
|
214
228
|
await initTeamLive(id, dir, cleanTask, { agentSessions, roleCounts, roster });
|
|
215
229
|
await writeJsonAtomic(path.join(dir, 'team-gate.json'), { passed: false, analysis_artifact: false, triwiki_refreshed: false, triwiki_validated: false, consensus_artifact: false, implementation_team_fresh: false, review_artifact: false, integration_evidence: false, context7_evidence: false });
|
|
216
230
|
await setCurrent(root, routeState(id, route, 'TEAM_PARALLEL_ANALYSIS_SCOUTING', required, { prompt: cleanTask, agent_sessions: agentSessions, role_counts: roleCounts, context_tracking: 'triwiki' }));
|
|
217
|
-
return routeContext(route, id, cleanTask, required, `
|
|
231
|
+
return routeContext(route, id, cleanTask, required, `Read relevant TriWiki before scouting, run ${roster.bundle_size} parallel analysis_scout_N agents, write team-analysis.md, refresh and validate TriWiki with "${contextTracking.refresh_command}" or "${contextTracking.pack_command}" plus "${contextTracking.validate_command}", prune with "${contextTracking.prune_command}" when stale/oversized wiki state would pollute handoffs, use the refreshed pack during debate, refresh/validate again after consensus and implementation changes, follow high-trust claims and hydrate source/evidence for low-trust claims, then close debate agents and form a fresh ${roster.bundle_size}-person executor development team.`);
|
|
218
232
|
}
|
|
219
233
|
|
|
220
234
|
async function prepareResearch(root, route, task, required) {
|
|
@@ -273,6 +287,7 @@ Task: ${task}
|
|
|
273
287
|
Required skills: ${route.requiredSkills.join(', ')}
|
|
274
288
|
Stop gate: ${route.stopGate}
|
|
275
289
|
Subagents: ${routeRequiresSubagents(route, task) ? 'required before code-changing execution; spawn parallel workers/reviewers with disjoint ownership or record explicit unavailable/unsplittable evidence.' : 'optional'}
|
|
290
|
+
TriWiki: use relevant context before each route phase, hydrate low-trust claims during the phase, refresh after new findings or artifact changes, and validate before handoffs/final claims.
|
|
276
291
|
Reasoning: ${routeReasoning(route, task).effort} temporary; return to default after completion.
|
|
277
292
|
Next atomic action: ${next}`
|
|
278
293
|
};
|
|
@@ -302,6 +317,34 @@ function formatRalphQuestions(schema) {
|
|
|
302
317
|
}).join('\n');
|
|
303
318
|
}
|
|
304
319
|
|
|
320
|
+
async function clarificationStopReason(root, state, kind) {
|
|
321
|
+
const id = state?.mission_id || 'latest';
|
|
322
|
+
const routeName = state?.route_command || state?.route || state?.mode || 'route';
|
|
323
|
+
const isRalph = kind === 'ralph';
|
|
324
|
+
const schema = state?.mission_id ? await readJson(path.join(missionDir(root, state.mission_id), 'required-answers.schema.json'), null) : null;
|
|
325
|
+
const questionBlock = schema ? `\n\nRequired questions (reply in chat by slot id):\n${formatRalphQuestions(schema)}` : '';
|
|
326
|
+
const files = state?.mission_id ? `
|
|
327
|
+
Question file: .sneakoscope/missions/${state.mission_id}/questions.md
|
|
328
|
+
Answer schema: .sneakoscope/missions/${state.mission_id}/required-answers.schema.json` : '';
|
|
329
|
+
const command = isRalph
|
|
330
|
+
? `sks ralph answer ${id} answers.json, then sks ralph run ${id}`
|
|
331
|
+
: `sks pipeline answer ${id} answers.json, then continue the original ${routeName} route`;
|
|
332
|
+
const title = isRalph
|
|
333
|
+
? `Ralph mission ${id} is waiting for mandatory clarification answers.`
|
|
334
|
+
: `SKS ${routeName} is waiting for mandatory ambiguity-removal answers.`;
|
|
335
|
+
return `${title}
|
|
336
|
+
Do not finish or implement yet. Reprint these questions to the user if they are not already visible.${files}
|
|
337
|
+
|
|
338
|
+
The user can answer directly in chat as plain text, for example:
|
|
339
|
+
GOAL_PRECISE: ...
|
|
340
|
+
ACCEPTANCE_CRITERIA:
|
|
341
|
+
- ...
|
|
342
|
+
NON_GOALS:
|
|
343
|
+
- ...
|
|
344
|
+
|
|
345
|
+
After the user answers, convert the reply to answers.json and run: ${command}.${questionBlock}`;
|
|
346
|
+
}
|
|
347
|
+
|
|
305
348
|
export async function recordContext7Evidence(root, state, payload) {
|
|
306
349
|
const stage = context7Stage(payload);
|
|
307
350
|
if (!stage) return null;
|
|
@@ -412,11 +455,11 @@ export async function evaluateStop(root, state, payload, opts = {}) {
|
|
|
412
455
|
const last = extractLastMessage(payload);
|
|
413
456
|
if (state?.mode === 'RALPH' && ['RALPH_PREPARE', 'RALPH_AWAITING_ANSWERS'].includes(state.phase)) {
|
|
414
457
|
if (looksLikeRalphQuestionResponse(last)) return { continue: true };
|
|
415
|
-
return { decision: 'block', reason:
|
|
458
|
+
return { decision: 'block', reason: await clarificationStopReason(root, state, 'ralph') };
|
|
416
459
|
}
|
|
417
460
|
if (state?.clarification_required && String(state.phase || '').includes('CLARIFICATION_AWAITING_ANSWERS')) {
|
|
418
461
|
if (looksLikeRalphQuestionResponse(last)) return { continue: true };
|
|
419
|
-
return { decision: 'block', reason:
|
|
462
|
+
return { decision: 'block', reason: await clarificationStopReason(root, state, 'route') };
|
|
420
463
|
}
|
|
421
464
|
if (state?.mode === 'RALPH' && state.phase === 'DECISION_CONTRACT_SEALED') {
|
|
422
465
|
return { decision: 'block', reason: `Ralph mission ${state.mission_id || 'latest'} has a sealed decision contract but has not run. Continue automatically by running: sks ralph run ${state.mission_id || 'latest'}` };
|
package/src/core/routes.mjs
CHANGED
|
@@ -39,13 +39,31 @@ export function triwikiContextTracking(commandPrefix = 'sks') {
|
|
|
39
39
|
validate_command: `${prefix} wiki validate .sneakoscope/wiki/context-pack.json`,
|
|
40
40
|
hydrate_policy: 'hydrate_by_id_hash_source_path_rgba_trig_coordinate',
|
|
41
41
|
selected_text_policy: 'selected_text_is_only_the_visible_slice',
|
|
42
|
-
|
|
42
|
+
stage_policy: [
|
|
43
|
+
'before_each_route_stage_read_relevant_context_pack',
|
|
44
|
+
'during_each_stage_hydrate_relevant_low_trust_claims_from_source',
|
|
45
|
+
'after_new_findings_or_artifact_changes_refresh_or_pack',
|
|
46
|
+
'before_each_handoff_validate_context_pack',
|
|
47
|
+
'before_final_answer_recheck_relevant_wiki_claims_against_sources'
|
|
48
|
+
],
|
|
49
|
+
required_for: ['every_work_stage', 'long_running_routes', 'team_handoffs', 'context_pressure', 'cross_turn_continuity']
|
|
43
50
|
};
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
export function triwikiContextTrackingText(commandPrefix = 'sks') {
|
|
47
54
|
const ctx = triwikiContextTracking(commandPrefix);
|
|
48
|
-
return `Context tracking SSOT: TriWiki.
|
|
55
|
+
return `Context tracking SSOT: TriWiki. Use relevant TriWiki context at every work stage, not only at the first refresh: read ${ctx.default_pack} before each route phase, hydrate relevant low-trust claims from source during the phase, refresh with "${ctx.refresh_command}" or "${ctx.pack_command}" after new findings/artifact changes, prune stale/oversized wiki state with "${ctx.prune_command}" when retention matters, and validate with "${ctx.validate_command}" before each handoff or final claim. Selected text is only the visible slice; non-selected claims remain hydratable by id, hash, source path, and RGBA/trig coordinate. Follow high-trust claims unless newer source evidence contradicts them; low-trust claims should trigger source/evidence hydration before implementation or final claims.`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function triwikiStagePolicyText(commandPrefix = 'sks') {
|
|
59
|
+
const ctx = triwikiContextTracking(commandPrefix);
|
|
60
|
+
return [
|
|
61
|
+
'TriWiki stage policy:',
|
|
62
|
+
`- Before each route phase, read the relevant parts of ${ctx.default_pack} instead of relying on memory or a one-time initial summary.`,
|
|
63
|
+
'- During the phase, when a decision touches a wiki claim, hydrate low-trust or stale claims from their source path/hash/RGBA anchor before relying on them.',
|
|
64
|
+
`- After new findings, changed artifacts, scout results, debate conclusions, implementation changes, reviews, or blockers, run "${ctx.refresh_command}" or "${ctx.pack_command}" so later stages see the update.`,
|
|
65
|
+
`- Before every handoff and before final output, run or require "${ctx.validate_command}" and re-check high-impact claims against current sources.`
|
|
66
|
+
].join('\n');
|
|
49
67
|
}
|
|
50
68
|
|
|
51
69
|
export const ROUTES = [
|
|
@@ -176,6 +194,21 @@ export const ROUTES = [
|
|
|
176
194
|
cliEntrypoint: 'sks gx init|render|validate|drift|snapshot',
|
|
177
195
|
examples: ['$GX render a visual context cartridge']
|
|
178
196
|
},
|
|
197
|
+
{
|
|
198
|
+
id: 'Wiki',
|
|
199
|
+
command: '$Wiki',
|
|
200
|
+
mode: 'WIKI',
|
|
201
|
+
route: 'TriWiki refresh and maintenance',
|
|
202
|
+
description: 'Refresh, pack, validate, or prune TriWiki context packs from Codex App.',
|
|
203
|
+
appSkillAliases: ['wiki-refresh', 'wikirefresh'],
|
|
204
|
+
requiredSkills: ['wiki', 'sks', 'honest-mode'],
|
|
205
|
+
lifecycle: ['intent_classification', 'wiki_refresh_or_pack', 'wiki_validate', 'honest_mode'],
|
|
206
|
+
context7Policy: 'optional',
|
|
207
|
+
reasoningPolicy: 'medium',
|
|
208
|
+
stopGate: 'none',
|
|
209
|
+
cliEntrypoint: 'sks wiki refresh|pack|validate|prune',
|
|
210
|
+
examples: ['$Wiki refresh', '$WikiRefresh prune and validate']
|
|
211
|
+
},
|
|
179
212
|
{
|
|
180
213
|
id: 'Help',
|
|
181
214
|
command: '$Help',
|
|
@@ -278,6 +311,7 @@ export function routePrompt(prompt) {
|
|
|
278
311
|
if (/\b(team|multi-agent|subagent|parallel agents|agent team|병렬|팀)\b/i.test(text)) return routeById('Team');
|
|
279
312
|
if (/\b(autoresearch|experiment|benchmark|SEO|GEO|ranking|optimi[sz]e|improve metric|discoverability|visibility|github stars?|npm downloads?|검색|노출|스타|다운로드)\b/i.test(text)) return routeById('AutoResearch');
|
|
280
313
|
if (/\b(research|hypothesis|falsify|novelty|frontier|조사|연구)\b/i.test(text)) return routeById('Research');
|
|
314
|
+
if (/(wiki\s+(refresh|pack|validate|prune)|triwiki\s+(refresh|pack|validate)|위키\s*(갱신|리프레시|정리|검증|패킹)|트라이위키|triwiki)/i.test(text)) return routeById('Wiki');
|
|
281
315
|
if (/\b(GX|vgraph|visual context|render cartridge|wiki coordinate|rgba|trig|llm wiki)\b/i.test(text)) return routeById('GX');
|
|
282
316
|
return routeById('SKS');
|
|
283
317
|
}
|
|
@@ -307,7 +341,7 @@ export function routeNeedsContext7(route, prompt = '') {
|
|
|
307
341
|
export function routeRequiresSubagents(route, prompt = '') {
|
|
308
342
|
if (!route) return false;
|
|
309
343
|
if (route.id === 'Team') return true;
|
|
310
|
-
if (route.id === 'Help' || route.id === 'SKS' || route.id === 'Answer') return false;
|
|
344
|
+
if (route.id === 'Help' || route.id === 'SKS' || route.id === 'Answer' || route.id === 'Wiki') return false;
|
|
311
345
|
if (route.id === 'Research' || route.id === 'AutoResearch') return true;
|
|
312
346
|
if (route.id === 'Ralph' || route.id === 'DB' || route.id === 'GX') return looksLikeExecutionWork(prompt);
|
|
313
347
|
if (route.id === 'DFix') return looksLikeCodeChangingWork(prompt) && !looksLikeFastDesignFix(prompt);
|
package/src/core/team-live.mjs
CHANGED
|
@@ -70,7 +70,7 @@ export function defaultTeamDashboard(id, prompt, opts = {}) {
|
|
|
70
70
|
event: `sks team event ${id} --agent <agent> --phase <phase> --message "..."`
|
|
71
71
|
},
|
|
72
72
|
agents: Object.fromEntries([...new Set([...DEFAULT_AGENTS, ...spec.roster.all_agents.map((agent) => agent.id)])].map((name) => [name, { status: 'pending', phase: null, last_seen: null }])),
|
|
73
|
-
phases: ['parallel_analysis_scouting', 'triwiki_refresh', 'debate_team', '
|
|
73
|
+
phases: ['parallel_analysis_scouting', 'triwiki_refresh', 'debate_team', 'triwiki_refresh_after_consensus', 'parallel_development_team', 'triwiki_refresh_after_implementation', 'strict_review_and_user_acceptance'],
|
|
74
74
|
latest_messages: []
|
|
75
75
|
};
|
|
76
76
|
}
|
|
@@ -96,7 +96,8 @@ ${prompt}
|
|
|
96
96
|
- This file is the Codex App-visible replacement for tmux-style team panes.
|
|
97
97
|
- Use at most ${spec.agentSessions} subagent sessions at a time unless the mission is recreated with a different budget.
|
|
98
98
|
- Team mode has three bundles: parallel analysis scouts first, debate team second, then fresh parallel development team.
|
|
99
|
-
-
|
|
99
|
+
- Use relevant TriWiki context before every stage, hydrate low-trust claims from source during the stage, refresh after findings/artifact changes, and validate before handoffs or final claims.
|
|
100
|
+
- Analysis scouts are read-only and split repo, docs, tests, risk, API, and user-flow investigation before the parent refreshes TriWiki for debate.
|
|
100
101
|
- executor:N means build N debate participants and then a separate N-person executor development team.
|
|
101
102
|
- User personas are intentionally impatient, self-interested, stubborn, low-context, and dislike inconvenience.
|
|
102
103
|
- Executors are capable developers with disjoint ownership.
|