@pi-unipi/unipi 0.1.1
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 +143 -0
- package/package.json +70 -0
- package/packages/btw/README.md +95 -0
- package/packages/btw/extensions/btw.ts +1972 -0
- package/packages/btw/skills/btw/SKILL.md +149 -0
- package/packages/core/README.md +74 -0
- package/packages/core/index.ts +10 -0
- package/packages/info-screen/README.md +115 -0
- package/packages/info-screen/index.ts +165 -0
- package/packages/memory/README.md +94 -0
- package/packages/memory/index.ts +209 -0
- package/packages/memory/skills/memory/SKILL.md +151 -0
- package/packages/ralph/README.md +101 -0
- package/packages/ralph/index.ts +548 -0
- package/packages/subagents/README.md +114 -0
- package/packages/unipi/index.ts +28 -0
- package/packages/workflow/README.md +129 -0
- package/packages/workflow/index.ts +155 -0
- package/packages/workflow/skills/brainstorm/SKILL.md +202 -0
- package/packages/workflow/skills/consolidate/SKILL.md +142 -0
- package/packages/workflow/skills/consultant/SKILL.md +97 -0
- package/packages/workflow/skills/document/SKILL.md +120 -0
- package/packages/workflow/skills/gather-context/SKILL.md +122 -0
- package/packages/workflow/skills/plan/SKILL.md +169 -0
- package/packages/workflow/skills/quick-work/SKILL.md +110 -0
- package/packages/workflow/skills/review-work/SKILL.md +131 -0
- package/packages/workflow/skills/scan-issues/SKILL.md +183 -0
- package/packages/workflow/skills/work/SKILL.md +144 -0
- package/packages/workflow/skills/worktree-create/SKILL.md +69 -0
- package/packages/workflow/skills/worktree-list/SKILL.md +67 -0
- package/packages/workflow/skills/worktree-merge/SKILL.md +79 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @pi-unipi/workflow
|
|
2
|
+
|
|
3
|
+
Structured development workflow commands for Pi coding agent.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
13 slash commands that guide work from idea to completion. Each command maps to a skill that instructs the agent on what to do.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
| Command | Description | Format |
|
|
12
|
+
|---------|-------------|--------|
|
|
13
|
+
| `/unipi:brainstorm` | Collaborative discovery, write design spec | `<string>` |
|
|
14
|
+
| `/unipi:plan` | Create implementation plan from specs | `specs:<path> <string>` |
|
|
15
|
+
| `/unipi:work` | Execute plan in worktree | `worktree:<branch> specs:<path> <string>` |
|
|
16
|
+
| `/unipi:review-work` | Review work, run checks, mark remarks | `plan:<path> <string>` |
|
|
17
|
+
| `/unipi:consolidate` | Save learnings, craft skills | `<string>` |
|
|
18
|
+
| `/unipi:worktree-create` | Create git worktree | `<string>` |
|
|
19
|
+
| `/unipi:worktree-list` | List all unipi worktrees | — |
|
|
20
|
+
| `/unipi:worktree-merge` | Merge worktrees to main | `<branch> <string>` |
|
|
21
|
+
| `/unipi:consultant` | Expert advisory | `<string>` |
|
|
22
|
+
| `/unipi:quick-work` | Fast single-task execution | `<string>` |
|
|
23
|
+
| `/unipi:gather-context` | Research codebase, prepare for brainstorm | `<string>` |
|
|
24
|
+
| `/unipi:document` | Generate documentation | `<string>` |
|
|
25
|
+
| `/unipi:scan-issues` | Find bugs, anti-patterns, security issues | `<string>` |
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
brainstorm → plan → work → review-work → consolidate
|
|
31
|
+
↑ │
|
|
32
|
+
└────────────────────────────────────────┘
|
|
33
|
+
(loop)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Typical Flow
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# 1. Brainstorm an idea
|
|
40
|
+
/unipi:brainstorm redesign auth system
|
|
41
|
+
|
|
42
|
+
# 2. Create implementation plan
|
|
43
|
+
/unipi:plan specs:2026-04-26-auth-redesign-design
|
|
44
|
+
|
|
45
|
+
# 3. Execute plan in worktree
|
|
46
|
+
/unipi:work worktree:feat/auth specs:2026-04-26-auth-redesign-plan
|
|
47
|
+
|
|
48
|
+
# 4. Review what was built
|
|
49
|
+
/unipi:review-work plan:2026-04-26-auth-redesign-plan
|
|
50
|
+
|
|
51
|
+
# 5. Consolidate learnings
|
|
52
|
+
/unipi:consolidate
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Quick Tasks
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# For small tasks that don't need full flow
|
|
59
|
+
/unipi:quick-work fix typo in README
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Research & Advisory
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Gather context before brainstorming
|
|
66
|
+
/unipi:gather-context how we handle errors
|
|
67
|
+
|
|
68
|
+
# Get expert advice
|
|
69
|
+
/unipi:consultant should we use GraphQL or REST?
|
|
70
|
+
|
|
71
|
+
# Generate documentation
|
|
72
|
+
/unipi:document the auth module
|
|
73
|
+
|
|
74
|
+
# Find issues
|
|
75
|
+
/unipi:scan-issues focus on security
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Worktree Management
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Create worktree
|
|
82
|
+
/unipi:worktree-create feat/new-feature
|
|
83
|
+
|
|
84
|
+
# List worktrees
|
|
85
|
+
/unipi:worktree-list
|
|
86
|
+
|
|
87
|
+
# Merge back to main
|
|
88
|
+
/ununi:worktree-merge feat/new-feature
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Directory Structure
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
.unipi/
|
|
95
|
+
├── docs/
|
|
96
|
+
│ ├── specs/ ← brainstorm output (design specs)
|
|
97
|
+
│ ├── plans/ ← plan output (implementation plans)
|
|
98
|
+
│ ├── generated/ ← document output (docs, guides)
|
|
99
|
+
│ └── reviews/ ← review remarks (in plan docs)
|
|
100
|
+
├── memory/ ← consolidate memory
|
|
101
|
+
├── quick-work/ ← quick-work summaries
|
|
102
|
+
└── worktrees/ ← git worktrees
|
|
103
|
+
├── feat/auth/
|
|
104
|
+
└── fix/login-bug/
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Integration
|
|
108
|
+
|
|
109
|
+
- **@pi-unipi/core** — shared constants, events, utilities
|
|
110
|
+
- **@pi-unipi/memory** — memory hooks for consolidate (optional)
|
|
111
|
+
- **@pi-unipi/subagents** — parallel research for gather-context, scan-issues (optional)
|
|
112
|
+
- **@pi-unipi/ralph** — loop integration for long-running tasks (optional)
|
|
113
|
+
|
|
114
|
+
## Installation
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npm install @pi-unipi/workflow
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Add to pi settings:
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"extensions": ["@unipi/workflow"]
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @unipi/workflow — Structured development workflow commands
|
|
3
|
+
*
|
|
4
|
+
* Registers 13 commands that dispatch to skills for LLM instruction.
|
|
5
|
+
* Emits MODULE_READY event for inter-module discovery.
|
|
6
|
+
* Detects @unipi/ralph presence for loop integration.
|
|
7
|
+
* Applies sandbox (tool filtering) per command.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
11
|
+
import {
|
|
12
|
+
UNIPI_EVENTS,
|
|
13
|
+
MODULES,
|
|
14
|
+
WORKFLOW_COMMANDS,
|
|
15
|
+
emitEvent,
|
|
16
|
+
getPackageVersion,
|
|
17
|
+
initUnipiDirs,
|
|
18
|
+
type SandboxLevel,
|
|
19
|
+
getToolsForLevel,
|
|
20
|
+
} from "@pi-unipi/core";
|
|
21
|
+
import { registerWorkflowCommands } from "./commands.js";
|
|
22
|
+
|
|
23
|
+
/** Package version (read from package.json at load time) */
|
|
24
|
+
const VERSION = getPackageVersion(new URL(".", import.meta.url).pathname);
|
|
25
|
+
|
|
26
|
+
/** Whether ralph module is detected */
|
|
27
|
+
let ralphDetected = false;
|
|
28
|
+
|
|
29
|
+
/** Saved tools before sandbox was applied (for restore) */
|
|
30
|
+
let savedTools: string[] | null = null;
|
|
31
|
+
|
|
32
|
+
/** Whether sandbox is currently active */
|
|
33
|
+
let sandboxActive = false;
|
|
34
|
+
|
|
35
|
+
/** Current sandbox level (null = no sandbox) */
|
|
36
|
+
let currentSandboxLevel: SandboxLevel | null = null;
|
|
37
|
+
|
|
38
|
+
export default function (pi: ExtensionAPI) {
|
|
39
|
+
// Register skills directory with pi's resource loader
|
|
40
|
+
const skillsDir = new URL("./skills", import.meta.url).pathname;
|
|
41
|
+
pi.on("resources_discover", async (_event, _ctx) => {
|
|
42
|
+
return {
|
|
43
|
+
skillPaths: [skillsDir],
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Register all workflow commands
|
|
48
|
+
registerWorkflowCommands(pi, {
|
|
49
|
+
isRalphDetected: () => ralphDetected,
|
|
50
|
+
getActiveTools: () => pi.getActiveTools(),
|
|
51
|
+
setActiveTools: (tools: string[], level: SandboxLevel) => {
|
|
52
|
+
pi.setActiveTools(tools);
|
|
53
|
+
sandboxActive = true;
|
|
54
|
+
currentSandboxLevel = level;
|
|
55
|
+
},
|
|
56
|
+
saveTools: (tools: string[]) => {
|
|
57
|
+
savedTools = tools;
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Block tool calls that violate sandbox
|
|
62
|
+
pi.on("tool_call", async (event, _ctx) => {
|
|
63
|
+
if (!sandboxActive || !currentSandboxLevel) return;
|
|
64
|
+
|
|
65
|
+
const allowed = getToolsForLevel(currentSandboxLevel);
|
|
66
|
+
if (!allowed.includes(event.toolName)) {
|
|
67
|
+
return {
|
|
68
|
+
block: true,
|
|
69
|
+
reason: `Tool "${event.toolName}" is not allowed in ${currentSandboxLevel} sandbox. Allowed: ${allowed.join(", ")}`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Inject sandbox constraints into system prompt so LLM knows its limits
|
|
75
|
+
pi.on("before_agent_start", async (event, _ctx) => {
|
|
76
|
+
if (!sandboxActive || !currentSandboxLevel) return;
|
|
77
|
+
|
|
78
|
+
const allowed = getToolsForLevel(currentSandboxLevel);
|
|
79
|
+
const blocked = ["read", "write", "edit", "bash", "grep", "find", "ls"]
|
|
80
|
+
.filter((t) => !allowed.includes(t));
|
|
81
|
+
|
|
82
|
+
const base = `\n\n<sandbox>\nSandbox mode: ${currentSandboxLevel}.\nAvailable tools: ${allowed.join(", ")}.\nBlocked tools: ${blocked.join(", ")} — removed from your tool list.`;
|
|
83
|
+
|
|
84
|
+
if (currentSandboxLevel === "brainstorm") {
|
|
85
|
+
return {
|
|
86
|
+
systemPrompt:
|
|
87
|
+
event.systemPrompt +
|
|
88
|
+
base +
|
|
89
|
+
`\nThe write tool is available but restricted to .unipi/docs/specs/ only.\nDo NOT attempt to call blocked tools. Do NOT output tool call XML for them.\nIf the user requests an action that requires a blocked tool, respond that you do not have access.\n</sandbox>`,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
systemPrompt:
|
|
95
|
+
event.systemPrompt +
|
|
96
|
+
base +
|
|
97
|
+
`\nDo NOT attempt to call blocked tools. Do NOT output tool call XML for them.\nIf the user requests an action that requires a blocked tool, respond that you do not have access.\n</sandbox>`,
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Restore tools when agent finishes
|
|
102
|
+
pi.on("agent_end", async (_event, _ctx) => {
|
|
103
|
+
if (sandboxActive && savedTools) {
|
|
104
|
+
pi.setActiveTools(savedTools);
|
|
105
|
+
savedTools = null;
|
|
106
|
+
sandboxActive = false;
|
|
107
|
+
currentSandboxLevel = null;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Announce module presence on session start
|
|
112
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
113
|
+
// Initialize .unipi directory structure
|
|
114
|
+
initUnipiDirs();
|
|
115
|
+
|
|
116
|
+
// Emit MODULE_READY
|
|
117
|
+
emitEvent(pi, UNIPI_EVENTS.MODULE_READY, {
|
|
118
|
+
name: MODULES.WORKFLOW,
|
|
119
|
+
version: VERSION,
|
|
120
|
+
commands: Object.values(WORKFLOW_COMMANDS),
|
|
121
|
+
tools: [],
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Listen for ralph module
|
|
125
|
+
if (!ralphDetected) {
|
|
126
|
+
try {
|
|
127
|
+
// Check if ralph tools exist (indicates @unipi/ralph is loaded)
|
|
128
|
+
const allTools = pi.getAllTools();
|
|
129
|
+
ralphDetected = allTools.some((t) => t.name === "ralph_start");
|
|
130
|
+
} catch {
|
|
131
|
+
// Ignore — ralph not present
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Show workflow status in UI
|
|
136
|
+
if (ctx.hasUI) {
|
|
137
|
+
const ralphStatus = ralphDetected ? "✓ ralph" : "○ ralph";
|
|
138
|
+
ctx.ui.setStatus("unipi-workflow", `⚡ workflow ${ralphStatus}`);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// Listen for ralph module ready event
|
|
143
|
+
pi.on(UNIPI_EVENTS.MODULE_READY as any, (event: any) => {
|
|
144
|
+
if (event?.name === MODULES.RALPH) {
|
|
145
|
+
ralphDetected = true;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Clean up on shutdown
|
|
150
|
+
pi.on("session_shutdown", async () => {
|
|
151
|
+
ralphDetected = false;
|
|
152
|
+
savedTools = null;
|
|
153
|
+
sandboxActive = false;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorm
|
|
3
|
+
description: "Collaborative discovery — explore problem space, evaluate approaches, write design spec. Use before any creative work."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Brainstorming Ideas Into Designs
|
|
7
|
+
|
|
8
|
+
Turn ideas into fully formed designs through collaborative dialogue.
|
|
9
|
+
|
|
10
|
+
## Boundaries
|
|
11
|
+
|
|
12
|
+
**This skill MAY:** research (read-only), discuss, ask questions, write the brainstorm document.
|
|
13
|
+
**This skill MAY NOT:** edit code, create files beyond the brainstorm document, run tests, deploy, implement anything.
|
|
14
|
+
|
|
15
|
+
**NEVER write code during this skill. This is a discussion, not implementation.**
|
|
16
|
+
|
|
17
|
+
## Command Format
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/unipi:brainstorm <string(greedy)>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- `string(greedy)` — the topic or problem to brainstorm about
|
|
24
|
+
- No worktree args — brainstorm runs in current session on current branch
|
|
25
|
+
- No visual companion — text-only brainstorming
|
|
26
|
+
|
|
27
|
+
## Hard Gate
|
|
28
|
+
|
|
29
|
+
Do NOT write any code, scaffold any project, or take any implementation action until design is presented and user approved. This applies to EVERY project regardless of perceived simplicity.
|
|
30
|
+
|
|
31
|
+
## Anti-Pattern: "Too Simple For Design"
|
|
32
|
+
|
|
33
|
+
Every project goes through this process. A todo list, a utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause wasted work. Design can be short, but MUST present and get approval.
|
|
34
|
+
|
|
35
|
+
## Output Path
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
.unipi/docs/specs/YYYY-MM-DD-<topic>-design.md
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Committed to current branch. Accessible across worktrees via git.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Phase 1: Explore Project Context
|
|
46
|
+
|
|
47
|
+
1. Check files, docs, recent commits to understand current state
|
|
48
|
+
2. Assess scope: if request describes multiple independent subsystems, flag immediately
|
|
49
|
+
3. If too large for single spec, help decompose into sub-projects
|
|
50
|
+
|
|
51
|
+
**Exit:** Context gathered. Ready to ask questions.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Phase 2: Ask Clarifying Questions
|
|
56
|
+
|
|
57
|
+
Ask **one question at a time**. Don't dump a questionnaire.
|
|
58
|
+
|
|
59
|
+
Start with:
|
|
60
|
+
1. "What problem are we actually solving?" — strip assumptions, get root need
|
|
61
|
+
2. "Who has this problem and when?" — context changes solutions
|
|
62
|
+
3. "What does success look like?" — outcomes, not features
|
|
63
|
+
|
|
64
|
+
Prefer multiple choice when natural options exist. Validate assumptions explicitly.
|
|
65
|
+
|
|
66
|
+
**Exit:** Problem statement clear and reframed. Both agree on what solving.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Phase 3: Propose Approaches
|
|
71
|
+
|
|
72
|
+
Propose 2-3 different approaches with trade-offs:
|
|
73
|
+
- What each optimizes for (speed, flexibility, simplicity)
|
|
74
|
+
- What each costs (complexity, maintenance, time, risk)
|
|
75
|
+
- Prior art in codebase or industry
|
|
76
|
+
|
|
77
|
+
Present conversationally with recommendation and reasoning.
|
|
78
|
+
|
|
79
|
+
**If open questions emerge:** MUST ask user about each one. Don't assume.
|
|
80
|
+
|
|
81
|
+
**Exit:** Approach chosen. User signals decision.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Phase 4: Present Design
|
|
86
|
+
|
|
87
|
+
Once approach chosen, present design in sections:
|
|
88
|
+
- Scale each section to complexity (few sentences if straightforward, 200-300 words if nuanced)
|
|
89
|
+
- Ask after each section whether it looks right
|
|
90
|
+
- Cover: architecture, components, data flow, error handling, testing
|
|
91
|
+
- Be ready to go back and clarify
|
|
92
|
+
|
|
93
|
+
**Design for isolation and clarity:**
|
|
94
|
+
- Break into smaller units with one clear purpose
|
|
95
|
+
- Each unit communicates through well-defined interfaces
|
|
96
|
+
- Can someone understand unit without reading internals?
|
|
97
|
+
|
|
98
|
+
**Exit:** Design approved by user.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Phase 5: Write Design Document
|
|
103
|
+
|
|
104
|
+
Write to `.unipi/docs/specs/YYYY-MM-DD-<topic>-design.md`:
|
|
105
|
+
|
|
106
|
+
```markdown
|
|
107
|
+
---
|
|
108
|
+
title: "{Topic}"
|
|
109
|
+
type: brainstorm
|
|
110
|
+
date: YYYY-MM-DD
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
# {Topic}
|
|
114
|
+
|
|
115
|
+
## Problem Statement
|
|
116
|
+
{The actual problem, reframed}
|
|
117
|
+
|
|
118
|
+
## Context
|
|
119
|
+
{Key findings — what exists, what's been tried}
|
|
120
|
+
|
|
121
|
+
## Chosen Approach
|
|
122
|
+
{High-level description}
|
|
123
|
+
|
|
124
|
+
## Why This Approach
|
|
125
|
+
{Decision rationale, alternatives rejected}
|
|
126
|
+
|
|
127
|
+
## Design
|
|
128
|
+
{Architecture, components, data flow}
|
|
129
|
+
|
|
130
|
+
## Implementation Checklist
|
|
131
|
+
- [ ] Task 1 — description
|
|
132
|
+
- [ ] Task 2 — description
|
|
133
|
+
- [ ] Task 3 — description
|
|
134
|
+
|
|
135
|
+
## Open Questions
|
|
136
|
+
{Questions for planning phase}
|
|
137
|
+
|
|
138
|
+
## Out of Scope
|
|
139
|
+
{Explicitly excluded}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Checklist Items
|
|
143
|
+
|
|
144
|
+
The `## Implementation Checklist` section uses `- [ ]` markdown checkboxes. These are critical:
|
|
145
|
+
|
|
146
|
+
- **`[ ]` = unplanned** — not yet covered by a plan
|
|
147
|
+
- **`[x]` = planned** — marked when `/unipi:plan` covers this item
|
|
148
|
+
- Agent MUST fill in checklist items based on the design
|
|
149
|
+
- Each item should be a discrete, implementable task
|
|
150
|
+
- Items should be ordered by dependency (earlier items don't depend on later ones)
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Phase 6: Spec Self-Review
|
|
155
|
+
|
|
156
|
+
After writing, review with fresh eyes:
|
|
157
|
+
|
|
158
|
+
1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections? Fix them.
|
|
159
|
+
2. **Internal consistency:** Do sections contradict each other?
|
|
160
|
+
3. **Scope check:** Focused enough for single implementation plan?
|
|
161
|
+
4. **Ambiguity check:** Could any requirement be interpreted two ways? Pick one.
|
|
162
|
+
|
|
163
|
+
Fix issues inline. No need to re-review — fix and move on.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Phase 7: User Review Gate
|
|
168
|
+
|
|
169
|
+
After self-review passes:
|
|
170
|
+
|
|
171
|
+
> "Spec written and committed to `.unipi/docs/specs/YYYY-MM-DD-<topic>-design.md`. Please review and let me know if you want changes before we plan."
|
|
172
|
+
|
|
173
|
+
Wait for user response. If changes requested, make them and re-run self-review.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Phase 8: Handoff
|
|
178
|
+
|
|
179
|
+
Ask user what to do next:
|
|
180
|
+
|
|
181
|
+
1. **Proceed to /unipi:plan** — Turn decisions into implementation plan
|
|
182
|
+
2. **Keep exploring** — More questions or refine decisions
|
|
183
|
+
3. **Done for now** — Return later
|
|
184
|
+
|
|
185
|
+
If user selects "Proceed to /unipi:plan", suggest:
|
|
186
|
+
```
|
|
187
|
+
/unipi:plan specs:YYYY-MM-DD-<topic>-design
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Validate
|
|
193
|
+
|
|
194
|
+
Before delivering, verify:
|
|
195
|
+
|
|
196
|
+
- [ ] Problem was reframed — not accepted at face value
|
|
197
|
+
- [ ] At least 2 approaches explored with tradeoffs
|
|
198
|
+
- [ ] Every decision has rationale and rejected alternatives documented
|
|
199
|
+
- [ ] Implementation checklist has concrete, discrete tasks with `[ ]` markers
|
|
200
|
+
- [ ] Open questions listed — nothing swept under rug
|
|
201
|
+
- [ ] No code was written — only brainstorm document created
|
|
202
|
+
- [ ] `/unipi:plan` can start from this document without asking "what did you decide about X?"
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: consolidate
|
|
3
|
+
description: "Consolidate — save learnings to memory, craft skills if reusable. Use at end of work session or to summarize current state."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Consolidating Learnings
|
|
7
|
+
|
|
8
|
+
Capture what was learned, update memory, and craft skills when patterns emerge.
|
|
9
|
+
|
|
10
|
+
## Boundaries
|
|
11
|
+
|
|
12
|
+
**This skill MAY:** read/write `.unipi/memory/`, read session context, read plans/specs, write skill files if user approves.
|
|
13
|
+
**This skill MAY NOT:** edit production code, run tests, deploy.
|
|
14
|
+
|
|
15
|
+
## Command Format
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/unipi:consolidate <string(greedy)>(optional)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- `string(greedy)` — optional focus (e.g., "focus on auth patterns" or "summarize what we learned about testing")
|
|
22
|
+
- Two modes: **end-of-work** (memory + registry hooks) or **start/middle** (read context, consolidate ideas)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Mode 1: End of Work Session
|
|
27
|
+
|
|
28
|
+
Triggered when run after `/unipi:review-work` marks work as done.
|
|
29
|
+
|
|
30
|
+
### Phase 1: Gather Learnings
|
|
31
|
+
|
|
32
|
+
1. Read session context — what was discussed, decided, built
|
|
33
|
+
2. Read the plan and spec — what was the goal, what was achieved
|
|
34
|
+
3. Identify key learnings:
|
|
35
|
+
- Patterns discovered
|
|
36
|
+
- Decisions made and why
|
|
37
|
+
- Problems encountered and solutions
|
|
38
|
+
- Things that would be done differently
|
|
39
|
+
- Reusable approaches
|
|
40
|
+
|
|
41
|
+
**Exit:** Learnings identified.
|
|
42
|
+
|
|
43
|
+
### Phase 2: Update Memory
|
|
44
|
+
|
|
45
|
+
1. Check if `@unipi/memory` extension is installed
|
|
46
|
+
2. If not installed → skip memory, note to user
|
|
47
|
+
3. If installed:
|
|
48
|
+
- Read existing `.unipi/memory/` files
|
|
49
|
+
- Find relevant memory files (by topic, date, or tag)
|
|
50
|
+
- **Update in place** — don't always create new files
|
|
51
|
+
- Merge new learnings with existing knowledge
|
|
52
|
+
- Prevent stale data by updating, not appending
|
|
53
|
+
|
|
54
|
+
**Memory file format:**
|
|
55
|
+
```markdown
|
|
56
|
+
---
|
|
57
|
+
topic: {topic}
|
|
58
|
+
updated: YYYY-MM-DD
|
|
59
|
+
tags: [tag1, tag2]
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
# {Topic}
|
|
63
|
+
|
|
64
|
+
## Key Learnings
|
|
65
|
+
- {Learning 1}
|
|
66
|
+
- {Learning 2}
|
|
67
|
+
|
|
68
|
+
## Patterns
|
|
69
|
+
- {Pattern description}
|
|
70
|
+
|
|
71
|
+
## Decisions
|
|
72
|
+
- {Decision} — {Rationale}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Exit:** Memory updated.
|
|
76
|
+
|
|
77
|
+
### Phase 3: Skill Crafting
|
|
78
|
+
|
|
79
|
+
1. Check if `@unipi/registry` extension is installed
|
|
80
|
+
2. If not installed → skip, note to user
|
|
81
|
+
3. If installed, assess if learnings are reusable:
|
|
82
|
+
|
|
83
|
+
**Auto-create skill if:**
|
|
84
|
+
- Pattern will definitely be used in future runs
|
|
85
|
+
- Solution applies to recurring problem
|
|
86
|
+
- Workflow could be standardized
|
|
87
|
+
|
|
88
|
+
**Ask user if uncertain:**
|
|
89
|
+
> "I discovered a pattern that might be worth capturing as a skill: {description}. Should I create a skill for this?"
|
|
90
|
+
|
|
91
|
+
**Skip if:**
|
|
92
|
+
- One-off solution, unlikely to recur
|
|
93
|
+
- Too specific to current context
|
|
94
|
+
- User declines
|
|
95
|
+
|
|
96
|
+
**Exit:** Skill created or skipped.
|
|
97
|
+
|
|
98
|
+
### Phase 4: Summary
|
|
99
|
+
|
|
100
|
+
Report to user:
|
|
101
|
+
- What was saved to memory
|
|
102
|
+
- What skills were created (if any)
|
|
103
|
+
- Suggest next steps if any work remains
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Mode 2: Start / Middle of Session
|
|
108
|
+
|
|
109
|
+
Triggered when run without prior work session context.
|
|
110
|
+
|
|
111
|
+
### Phase 1: Read Context
|
|
112
|
+
|
|
113
|
+
1. Read session conversation so far
|
|
114
|
+
2. OR read latest brainstorm/spec/plan
|
|
115
|
+
3. Understand current state — what's been discussed, what's decided
|
|
116
|
+
|
|
117
|
+
### Phase 2: Consolidate Ideas
|
|
118
|
+
|
|
119
|
+
1. Summarize key points from context
|
|
120
|
+
2. Identify open questions
|
|
121
|
+
3. Identify decisions made
|
|
122
|
+
4. Identify next steps
|
|
123
|
+
|
|
124
|
+
### Phase 3: Write Summary
|
|
125
|
+
|
|
126
|
+
Write consolidation to `.unipi/memory/` — same format as Mode 1.
|
|
127
|
+
|
|
128
|
+
### Phase 4: Present
|
|
129
|
+
|
|
130
|
+
Present summary to user. Ask:
|
|
131
|
+
1. **Continue to brainstorm** — if ideas need formalizing
|
|
132
|
+
2. **Continue to plan** — if decisions are clear
|
|
133
|
+
3. **Done** — summary captured, return later
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Notes
|
|
138
|
+
|
|
139
|
+
- Memory files are living documents — update, don't always create new
|
|
140
|
+
- Skill creation is opportunistic — only when pattern is clearly reusable
|
|
141
|
+
- Both modes write to `.unipi/memory/` — consistent location
|
|
142
|
+
- Respects extension availability — graceful degradation if extensions not installed
|