@leing2021/super-pi 0.23.3 → 0.23.4
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/extensions/ce-core/index.ts +3 -1
- package/extensions/ce-core/tools/compaction-optimizer.ts +1 -9
- package/extensions/ce-core/tools/context-handoff.ts +15 -0
- package/package.json +1 -1
- package/skills/02-plan/SKILL.md +8 -7
- package/skills/03-work/SKILL.md +13 -11
- package/skills/04-review/SKILL.md +9 -8
- package/skills/06-next/SKILL.md +5 -3
- package/skills/06-next/references/recommendation-logic.md +46 -1
- package/skills/references/pipeline-config.md +28 -1
|
@@ -332,6 +332,7 @@ const contextHandoffParams = Type.Object({
|
|
|
332
332
|
openDecisions: Type.Optional(Type.Array(Type.String(), { description: "Pending decisions that affect next steps" })),
|
|
333
333
|
recentlyAccessedFiles: Type.Optional(Type.Array(Type.String(), { description: "Files recently read or edited (defaults to activeFiles)" })),
|
|
334
334
|
compressionRisk: Type.Optional(Type.Array(Type.String(), { description: "Context compression risks to watch for" })),
|
|
335
|
+
activeRules: Type.Optional(Type.Array(Type.String(), { description: "1-5 must-know rules for continuation (TDD gates, constraints, do-not-repeat)" })),
|
|
335
336
|
})
|
|
336
337
|
|
|
337
338
|
const patternExtractorParams = Type.Object({
|
|
@@ -772,6 +773,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
|
|
|
772
773
|
openDecisions: params.openDecisions,
|
|
773
774
|
recentlyAccessedFiles: params.recentlyAccessedFiles,
|
|
774
775
|
compressionRisk: params.compressionRisk,
|
|
776
|
+
activeRules: params.activeRules,
|
|
775
777
|
})
|
|
776
778
|
|
|
777
779
|
return {
|
|
@@ -891,4 +893,4 @@ export {
|
|
|
891
893
|
export { normalizeSlug } from "./utils/name-utils"
|
|
892
894
|
export { filterBashOutput } from "./tools/bash-output-filter"
|
|
893
895
|
export { filterReadOutput } from "./tools/read-output-filter"
|
|
894
|
-
export { COMPACTION_FOCUS_INSTRUCTIONS
|
|
896
|
+
export { COMPACTION_FOCUS_INSTRUCTIONS } from "./tools/compaction-optimizer"
|
|
@@ -27,12 +27,4 @@ export const COMPACTION_FOCUS_INSTRUCTIONS = `Additional focus for this summary:
|
|
|
27
27
|
6. If any tests were run, summarize results by: file, pass/fail count, and specific failure messages
|
|
28
28
|
7. Note any blocked items and their exact error state`
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
* Additional instructions for turn-prefix summaries (split turns).
|
|
32
|
-
* These are more concise since the turn suffix is retained.
|
|
33
|
-
*/
|
|
34
|
-
export const TURN_PREFIX_FOCUS_INSTRUCTIONS = `Focus the turn-prefix summary on:
|
|
35
|
-
- What the user originally asked for
|
|
36
|
-
- Key decisions made in the prefix
|
|
37
|
-
- Exact file paths and identifiers needed to understand the retained suffix
|
|
38
|
-
Skip reasoning details — only keep actionable context.`
|
|
30
|
+
|
|
@@ -37,6 +37,7 @@ export interface ContextHandoffInput {
|
|
|
37
37
|
openDecisions?: string[]
|
|
38
38
|
recentlyAccessedFiles?: string[]
|
|
39
39
|
compressionRisk?: string[]
|
|
40
|
+
activeRules?: string[]
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
export interface ContextStateEntry {
|
|
@@ -54,6 +55,7 @@ export interface ContextStateEntry {
|
|
|
54
55
|
openDecisions: string[]
|
|
55
56
|
recentlyAccessedFiles: string[]
|
|
56
57
|
compressionRisk: string[]
|
|
58
|
+
activeRules: string[]
|
|
57
59
|
recommendNewSession: boolean
|
|
58
60
|
updatedAt: string
|
|
59
61
|
}
|
|
@@ -77,6 +79,7 @@ export interface ContextHandoffResult {
|
|
|
77
79
|
openDecisions?: string[]
|
|
78
80
|
recentlyAccessedFiles?: string[]
|
|
79
81
|
compressionRisk?: string[]
|
|
82
|
+
activeRules?: string[]
|
|
80
83
|
updatedAt?: string
|
|
81
84
|
// Validation fields
|
|
82
85
|
ok?: boolean
|
|
@@ -154,6 +157,7 @@ function buildDefaultHandoffMarkdown(input: {
|
|
|
154
157
|
openDecisions: string[]
|
|
155
158
|
recentlyAccessedFiles: string[]
|
|
156
159
|
compressionRisk: string[]
|
|
160
|
+
activeRules: string[]
|
|
157
161
|
}): string {
|
|
158
162
|
const currentTask = input.nextStage
|
|
159
163
|
? `Continue from ${input.currentStage} to ${input.nextStage}.`
|
|
@@ -194,6 +198,9 @@ function buildDefaultHandoffMarkdown(input: {
|
|
|
194
198
|
"## Active Files",
|
|
195
199
|
activeFiles,
|
|
196
200
|
"",
|
|
201
|
+
"## Active Rules",
|
|
202
|
+
formatBullets(input.activeRules),
|
|
203
|
+
"",
|
|
197
204
|
"## Recently Accessed Files",
|
|
198
205
|
formatBullets(input.recentlyAccessedFiles),
|
|
199
206
|
"",
|
|
@@ -245,6 +252,7 @@ function normalizeStateEntry(raw: unknown): ContextStateEntry | null {
|
|
|
245
252
|
? toStringArray(state.recentlyAccessedFiles)
|
|
246
253
|
: activeFiles.slice(0, 5),
|
|
247
254
|
compressionRisk: toStringArray(state.compressionRisk),
|
|
255
|
+
activeRules: toStringArray(state.activeRules),
|
|
248
256
|
recommendNewSession: typeof state.recommendNewSession === "boolean" ? state.recommendNewSession : false,
|
|
249
257
|
updatedAt: typeof state.updatedAt === "string" ? state.updatedAt : new Date(0).toISOString(),
|
|
250
258
|
}
|
|
@@ -314,6 +322,7 @@ async function save(input: ContextHandoffInput): Promise<ContextHandoffResult> {
|
|
|
314
322
|
? input.recentlyAccessedFiles
|
|
315
323
|
: activeFiles.slice(0, 5)
|
|
316
324
|
const compressionRisk = input.compressionRisk ?? []
|
|
325
|
+
const activeRules = input.activeRules ?? []
|
|
317
326
|
|
|
318
327
|
const handoffMarkdown = input.handoffMarkdown?.trim().length
|
|
319
328
|
? input.handoffMarkdown
|
|
@@ -329,6 +338,7 @@ async function save(input: ContextHandoffInput): Promise<ContextHandoffResult> {
|
|
|
329
338
|
openDecisions,
|
|
330
339
|
recentlyAccessedFiles,
|
|
331
340
|
compressionRisk,
|
|
341
|
+
activeRules,
|
|
332
342
|
})
|
|
333
343
|
|
|
334
344
|
const recommendNewSession = computeRecommendNewSession(currentStage, nextStage, contextHealth)
|
|
@@ -356,6 +366,7 @@ async function save(input: ContextHandoffInput): Promise<ContextHandoffResult> {
|
|
|
356
366
|
openDecisions,
|
|
357
367
|
recentlyAccessedFiles,
|
|
358
368
|
compressionRisk,
|
|
369
|
+
activeRules,
|
|
359
370
|
recommendNewSession,
|
|
360
371
|
updatedAt: new Date().toISOString(),
|
|
361
372
|
}
|
|
@@ -379,6 +390,7 @@ async function save(input: ContextHandoffInput): Promise<ContextHandoffResult> {
|
|
|
379
390
|
openDecisions,
|
|
380
391
|
recentlyAccessedFiles,
|
|
381
392
|
compressionRisk,
|
|
393
|
+
activeRules,
|
|
382
394
|
recommendNewSession,
|
|
383
395
|
updatedAt: state.updatedAt,
|
|
384
396
|
}
|
|
@@ -419,6 +431,7 @@ async function load(input: ContextHandoffInput): Promise<ContextHandoffResult> {
|
|
|
419
431
|
openDecisions: state.openDecisions,
|
|
420
432
|
recentlyAccessedFiles: state.recentlyAccessedFiles,
|
|
421
433
|
compressionRisk: state.compressionRisk,
|
|
434
|
+
activeRules: state.activeRules,
|
|
422
435
|
recommendNewSession: state.recommendNewSession,
|
|
423
436
|
handoffMarkdown: markdown,
|
|
424
437
|
updatedAt: state.updatedAt,
|
|
@@ -453,6 +466,7 @@ async function latest(input: ContextHandoffInput): Promise<ContextHandoffResult>
|
|
|
453
466
|
openDecisions: state.openDecisions,
|
|
454
467
|
recentlyAccessedFiles: state.recentlyAccessedFiles,
|
|
455
468
|
compressionRisk: state.compressionRisk,
|
|
469
|
+
activeRules: state.activeRules,
|
|
456
470
|
recommendNewSession: state.recommendNewSession,
|
|
457
471
|
updatedAt: state.updatedAt,
|
|
458
472
|
}
|
|
@@ -755,6 +769,7 @@ async function status(input: ContextHandoffInput): Promise<ContextHandoffResult>
|
|
|
755
769
|
openDecisions: state.openDecisions,
|
|
756
770
|
recentlyAccessedFiles: state.recentlyAccessedFiles,
|
|
757
771
|
compressionRisk: state.compressionRisk,
|
|
772
|
+
activeRules: state.activeRules,
|
|
758
773
|
recommendNewSession: state.recommendNewSession,
|
|
759
774
|
updatedAt: state.updatedAt,
|
|
760
775
|
}
|
package/package.json
CHANGED
package/skills/02-plan/SKILL.md
CHANGED
|
@@ -39,13 +39,14 @@ Every unit follows **RED → GREEN → REFACTOR**:
|
|
|
39
39
|
|
|
40
40
|
## Planning flow
|
|
41
41
|
|
|
42
|
-
1.
|
|
43
|
-
2.
|
|
44
|
-
3.
|
|
45
|
-
4.
|
|
46
|
-
5. If
|
|
47
|
-
6.
|
|
48
|
-
7.
|
|
42
|
+
1. **Load context**: consume latest handoff before any broad file reads — `context_handoff load` or read `.context/compound-engineering/handoffs/latest.md`. If found, use `activeFiles` and `blocker` as starting point. If not found, proceed normally (new project).
|
|
43
|
+
2. Read relevant brainstorm from `docs/brainstorms/`
|
|
44
|
+
3. Run solution search (keywords → grep frontmatter → read top 3)
|
|
45
|
+
4. Gather repository context
|
|
46
|
+
5. If plan exists: use `plan_diff` `compare` → review with user → `patch`
|
|
47
|
+
6. If no plan: write new plan under `docs/plans/` using `references/plan-template.md`
|
|
48
|
+
7. Structure work using `references/implementation-unit-template.md`
|
|
49
|
+
8. Verify every unit follows TDD gates
|
|
49
50
|
|
|
50
51
|
## Optional: CEO Review
|
|
51
52
|
|
package/skills/03-work/SKILL.md
CHANGED
|
@@ -41,16 +41,18 @@ Every step follows **RED → GREEN → REFACTOR**:
|
|
|
41
41
|
|
|
42
42
|
## Workflow
|
|
43
43
|
|
|
44
|
-
1.
|
|
45
|
-
2.
|
|
46
|
-
3.
|
|
47
|
-
4.
|
|
48
|
-
5.
|
|
49
|
-
6.
|
|
50
|
-
7.
|
|
51
|
-
8.
|
|
52
|
-
9.
|
|
53
|
-
10.
|
|
54
|
-
11.
|
|
44
|
+
1. **Load context**: consume latest handoff before any broad file reads — `context_handoff load` or read `.context/compound-engineering/handoffs/latest.md`. If found, use `activeFiles`, `blocker`, `verification`, `activeRules` as starting point. If not found, proceed normally.
|
|
45
|
+
2. Detect input type (plan path vs bare prompt)
|
|
46
|
+
3. Read implementation units if plan path
|
|
47
|
+
4. Load `session_checkpoint` to skip completed units
|
|
48
|
+
5. Use `task_splitter` for dependency analysis
|
|
49
|
+
6. Execute: **inline mode** by default, `ce_parallel_subagent` for independent units
|
|
50
|
+
7. Follow TDD per unit: RED → minimal code → GREEN → refactor → unit-level **verification**
|
|
51
|
+
8. Record progress via `references/progress-update-format.md`
|
|
52
|
+
9. Save `session_checkpoint` after each unit
|
|
53
|
+
10. On failure: `session_checkpoint` `fail` → `retry` → follow strategy
|
|
54
|
+
11. Provide completion report (see `references/completion-report.md`)
|
|
55
|
+
12. **Save handoff**: `context_handoff save` with current stage, next stage, activeFiles, blocker, verification, activeRules
|
|
56
|
+
13. Handoff to `04-review` using `references/handoff.md`
|
|
55
57
|
|
|
56
58
|
Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).
|
|
@@ -46,14 +46,15 @@ Code review is **technical evaluation**, not social performance:
|
|
|
46
46
|
|
|
47
47
|
## Workflow
|
|
48
48
|
|
|
49
|
-
1.
|
|
50
|
-
2.
|
|
51
|
-
3.
|
|
52
|
-
4.
|
|
53
|
-
5.
|
|
54
|
-
6.
|
|
55
|
-
7.
|
|
56
|
-
8.
|
|
49
|
+
1. **Load context**: consume latest handoff before any broad file reads — `context_handoff load` or read `.context/compound-engineering/handoffs/latest.md`. If found, use `activeFiles`, `artifacts.plan` as starting point. If not found, proceed normally.
|
|
50
|
+
2. Determine diff scope from branch or explicit target
|
|
51
|
+
3. Collect stats (files, insertions, deletions) → call `review_router`
|
|
52
|
+
4. Read matching plan artifact
|
|
53
|
+
5. Run solution search
|
|
54
|
+
6. Apply each reviewer persona from `review_router`
|
|
55
|
+
7. Merge into structured findings
|
|
56
|
+
8. Verify each finding against codebase
|
|
57
|
+
9. Apply autofixes, re-run tests, re-review if needed
|
|
57
58
|
|
|
58
59
|
## Optional: QA Test Mode
|
|
59
60
|
|
package/skills/06-next/SKILL.md
CHANGED
|
@@ -22,8 +22,9 @@ Use this skill when the user wants to know what to run next in the Compound Engi
|
|
|
22
22
|
When the user asks "what should I do next?", "continue", or runs `/skill:06-next`:
|
|
23
23
|
|
|
24
24
|
1. Call `workflow_state` with the repo root
|
|
25
|
-
2.
|
|
26
|
-
3.
|
|
25
|
+
2. Inspect `workflow_state.context` first — apply **context-first priority chain** from `references/recommendation-logic.md` (health → blocker → recommendNewSession → nextStage → mismatch → fallback)
|
|
26
|
+
3. If no context signals trigger, fall back to artifact-count rules
|
|
27
|
+
4. Return: skill name, reason (1-2 lines), brief workflow state summary
|
|
27
28
|
|
|
28
29
|
### Verbose mode: "full status"
|
|
29
30
|
|
|
@@ -31,7 +32,8 @@ When the user asks "show status", "what's the current state", or uses `--verbose
|
|
|
31
32
|
|
|
32
33
|
1. Call `workflow_state` with the repo root
|
|
33
34
|
2. Call `session_history` with `latest` operation
|
|
34
|
-
3.
|
|
35
|
+
3. Include context health assessment from `workflow_state.context` in the status report
|
|
36
|
+
4. Return: latest artifacts (path + summary), status of each phase, context health, recommended next step
|
|
35
37
|
|
|
36
38
|
## Artifact locations
|
|
37
39
|
|
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
# Recommendation logic
|
|
2
2
|
|
|
3
|
-
Apply these rules in order. Return the first match.
|
|
3
|
+
Apply these rules in strict priority order. Return the first match.
|
|
4
|
+
|
|
5
|
+
## Context-first priority chain
|
|
6
|
+
|
|
7
|
+
`06-next` must call `workflow_state` and inspect `workflow_state.context` **before** applying artifact-count rules. Context health and runtime state override stale artifact counts.
|
|
8
|
+
|
|
9
|
+
Field mapping: the requirement uses `context.health` as a conceptual alias. Use the actual field name `workflow_state.context.contextHealth`.
|
|
10
|
+
|
|
11
|
+
### Priority 1: Critical context health
|
|
12
|
+
|
|
13
|
+
If `context.contextHealth` is `"critical"`:
|
|
14
|
+
- Recommend: save a `context_handoff` with full handoff-lite template, then open a **new session**.
|
|
15
|
+
- Reason: Current session context is critically inflated. Continuing will degrade decision quality and waste tokens.
|
|
16
|
+
- Output: handoff-save guidance + copyable new-session prompt with repo path and artifact references.
|
|
17
|
+
|
|
18
|
+
### Priority 2: Active blocker
|
|
19
|
+
|
|
20
|
+
If `context.blocker` exists and is not `"N/A"` or a placeholder:
|
|
21
|
+
- Recommend: return to the current stage (`context.currentStage`) and resolve the blocker before advancing.
|
|
22
|
+
- Reason: A known blocker exists in the current pipeline stage.
|
|
23
|
+
- Output: `/skill:<currentStage>` with blocker description.
|
|
24
|
+
|
|
25
|
+
### Priority 3: New session recommended
|
|
26
|
+
|
|
27
|
+
If `context.recommendNewSession === true`:
|
|
28
|
+
- Recommend: open a new Pi session.
|
|
29
|
+
- Reason: The previous stage determined that context health + phase transition warrant a fresh session.
|
|
30
|
+
- Output: copyable new-session prompt referencing `context.latestHandoffPath`, artifacts, and next stage.
|
|
31
|
+
|
|
32
|
+
### Priority 4: Explicit next stage
|
|
33
|
+
|
|
34
|
+
If `context.nextStage` exists, is meaningful, and differs from `context.currentStage`:
|
|
35
|
+
- Recommend: `/skill:<context.nextStage>`.
|
|
36
|
+
- Reason: The previous stage explicitly requested this transition.
|
|
37
|
+
- Output: recommended skill command.
|
|
38
|
+
|
|
39
|
+
### Priority 5: Stage mismatch detection
|
|
40
|
+
|
|
41
|
+
If `context.currentStage` does not match the most recent artifact state (e.g. a plan exists but context says `"01-brainstorm"`):
|
|
42
|
+
- Recommend: the skill that matches the most recent artifact, or ask the user to clarify.
|
|
43
|
+
- Reason: Runtime context and artifact state are out of sync.
|
|
44
|
+
- Output: suggested correction with explanation of the mismatch.
|
|
45
|
+
|
|
46
|
+
### Priority 6: Fallback — artifact-count rules
|
|
47
|
+
|
|
48
|
+
If none of the above context rules triggered, fall back to the artifact-count rules below.
|
|
4
49
|
|
|
5
50
|
## Rule 1: No brainstorm artifacts
|
|
6
51
|
|
|
@@ -18,7 +18,34 @@ Supported `modelStrategy` formats in `.pi/settings.json`:
|
|
|
18
18
|
- Full reference: `"02-plan": "anthropic/claude-opus-4-1"`
|
|
19
19
|
- Bare model id (reuses current provider): `"02-plan": "claude-opus-4-1"`
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Start of skill: context loading
|
|
22
|
+
|
|
23
|
+
Before reading any project files or running repository-wide scans, load the most recent handoff:
|
|
24
|
+
|
|
25
|
+
1. Try `context_handoff load` or `context_handoff latest` first.
|
|
26
|
+
2. Fallback: `read .context/compound-engineering/handoffs/latest.md` if tool is unavailable.
|
|
27
|
+
3. **Handoff found?** Consume its `activeFiles`, `blocker`, `verification`, `currentTruth`, `activeRules` before any broad project reads.
|
|
28
|
+
4. **No handoff?** Proceed normally — this is a new project or first run. Do not block.
|
|
29
|
+
|
|
30
|
+
Core principle: **consume handoff before broad project file reads** — a single handoff read (~500 tokens) avoids 5-10 project file scans (~5K-10K tokens).
|
|
31
|
+
|
|
32
|
+
## End of skill: save handoff + status + context
|
|
33
|
+
|
|
34
|
+
Every Phase 1 skill (02-plan through 05-learn) must save context handoff at completion:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
context_handoff save
|
|
38
|
+
currentStage: <stageKey>
|
|
39
|
+
nextStage: <next stage>
|
|
40
|
+
contextHealth: good | watch | heavy | critical
|
|
41
|
+
activeFiles: [1-5 currently active paths]
|
|
42
|
+
blocker: <blocker or N/A>
|
|
43
|
+
verification: <latest command + result>
|
|
44
|
+
activeRules: [1-5 rules critical for continuation]
|
|
45
|
+
currentTruth: [validated truths]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If `context_handoff` is unavailable, manually write the Handoff-lite template to `.context/compound-engineering/handoffs/latest.md`.
|
|
22
49
|
|
|
23
50
|
Before final completion, always output these blocks (replace placeholders with real values, never output angle-bracket placeholders literally):
|
|
24
51
|
|