@opensassi/opencode 0.1.0 → 0.1.3
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 +4 -3
- package/lib/commands/init.js +37 -0
- package/package.json +2 -2
- package/scripts/list-targets.sh +49 -0
- package/skills/git/SKILL.md +19 -1
- package/skills/npm-optimizer/SKILL.md +182 -98
- package/skills/npx/SKILL.md +80 -0
- package/skills/opensassi/SKILL.md +150 -52
- package/skills/todo/SKILL.md +45 -63
- package/skills-index.json +84 -72
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @opensassi/opencode
|
|
2
2
|
|
|
3
|
-
Agent skill harness for AI-assisted software development. Delivers
|
|
3
|
+
Agent skill harness for AI-assisted software development. Delivers 13 domain-specific skills (system-design, git workflow, profiling, etc.) and supporting scripts as a standalone npm CLI package.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
npx @opensassi/opencode init
|
|
@@ -43,13 +43,14 @@ npx @opensassi/opencode help # Show help
|
|
|
43
43
|
| `daily-evaluation` | Aggregate session evaluations into dashboards |
|
|
44
44
|
| `git` | Rebase-based single-commit-per-session workflow |
|
|
45
45
|
| `issue` | GitHub issue management |
|
|
46
|
-
| `npm-optimizer` | Port an npm package to a C++ native addon |
|
|
46
|
+
| `npm-optimizer` | Port an npm package to a C++ native addon — 100% test compatibility through profiling-driven iteration |
|
|
47
47
|
| `opensassi` | Bootstrap a new project environment |
|
|
48
48
|
| `profiler` | Linux perf profiling + flamegraphs |
|
|
49
49
|
| `session-evaluation` | Generate structured session reports |
|
|
50
50
|
| `skill-manager` | Create/revise skills interactively |
|
|
51
51
|
| `system-design` | Interactive C++ spec authoring with diagrams |
|
|
52
52
|
| `system-design-review` | Seven-expert panel audit of technical specs |
|
|
53
|
+
| `npx` | Run npx commands in a target directory with automatic directory resolution |
|
|
53
54
|
| `todo` | Create issues + debugging skills from session context |
|
|
54
55
|
|
|
55
56
|
## Package Contents
|
|
@@ -58,7 +59,7 @@ npx @opensassi/opencode help # Show help
|
|
|
58
59
|
|-----------|----------|
|
|
59
60
|
| `bin/` | CLI entry point (`opencode` binary) |
|
|
60
61
|
| `lib/` | Programmatic API + command implementations |
|
|
61
|
-
| `skills/` |
|
|
62
|
+
| `skills/` | 13 skill definitions (SKILL.md) + skill scripts |
|
|
62
63
|
| `scripts/` | Artifact pipeline (extract, test, verify, check) + installers |
|
|
63
64
|
| `AGENTS.md` | Agent harness instructions (appended by init) |
|
|
64
65
|
| `skills-index.json` | Pre-built static skill/command index |
|
package/lib/commands/init.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync, existsSync, mkdirSync, writeFileSync, appendFileSync } from 'node:fs'
|
|
2
2
|
import { resolve } from 'node:path'
|
|
3
|
+
import { spawn } from 'node:child_process'
|
|
3
4
|
import { resolveAgents, resolveSkill, PKG_ROOT } from '../util/paths.js'
|
|
4
5
|
|
|
5
6
|
function readPackageAgents() {
|
|
@@ -114,4 +115,40 @@ export async function initCommand(args) {
|
|
|
114
115
|
console.log('.opencode/skills/ already in .gitignore')
|
|
115
116
|
}
|
|
116
117
|
}
|
|
118
|
+
|
|
119
|
+
// === Post-write: handoff to opencode ===
|
|
120
|
+
|
|
121
|
+
if (process.env.OPENCODE === '1') {
|
|
122
|
+
console.log('\nFiles written. Use `skill opensassi` to continue within this session.')
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
await spawnOpencode(cwd)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function spawnOpencode(cwd) {
|
|
130
|
+
const { spawnSync } = await import('node:child_process')
|
|
131
|
+
const platform = process.platform
|
|
132
|
+
const whichCmd = platform === 'win32' ? 'where' : 'command'
|
|
133
|
+
const whichArgs = platform === 'win32' ? ['opencode.cmd'] : ['-v', 'opencode']
|
|
134
|
+
|
|
135
|
+
const check = spawnSync(whichCmd, whichArgs, { stdio: 'ignore' })
|
|
136
|
+
if (check.status !== 0) {
|
|
137
|
+
console.log('\nopencode is not installed.\nInstall it, then run: opencode')
|
|
138
|
+
console.log(' curl -fsSL https://opencode.ai/install.sh | sh')
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
console.log('\nInitializing opensassi inside opencode...')
|
|
143
|
+
const child = spawn('opencode', ['run', '--print-logs', 'skill opensassi'], {
|
|
144
|
+
cwd,
|
|
145
|
+
stdio: 'inherit',
|
|
146
|
+
env: { ...process.env }
|
|
147
|
+
})
|
|
148
|
+
return new Promise((resolve) => {
|
|
149
|
+
child.on('exit', (code) => {
|
|
150
|
+
if (code !== 0) console.log(`\nopencode exited with code ${code}`)
|
|
151
|
+
resolve()
|
|
152
|
+
})
|
|
153
|
+
})
|
|
117
154
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensassi/opencode",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Agent skill harness for opencode — bootstrap, system-design, git workflow, profiling, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,4 +37,4 @@
|
|
|
37
37
|
"playwright": "^1.60.0",
|
|
38
38
|
"sharp": "^0.34.5"
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT="$(cd "${1:-.}" && pwd)"
|
|
5
|
+
|
|
6
|
+
echo "["
|
|
7
|
+
|
|
8
|
+
# 1. Project root
|
|
9
|
+
echo " {\"name\": \".\", \"path\": \"$ROOT\", \"type\": \"project-root\"}"
|
|
10
|
+
|
|
11
|
+
# 2. external/ subdirectories
|
|
12
|
+
sep=","
|
|
13
|
+
if [ -d "$ROOT/external" ]; then
|
|
14
|
+
for dir in "$ROOT/external"/*/; do
|
|
15
|
+
[ -d "$dir" ] || continue
|
|
16
|
+
name="$(basename "$dir")"
|
|
17
|
+
abspath="$(cd "$dir" && pwd)"
|
|
18
|
+
echo "$sep"
|
|
19
|
+
echo -n " {\"name\": \"$name\", \"path\": \"$abspath\", \"type\": \"external\"}"
|
|
20
|
+
sep=","
|
|
21
|
+
done
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# 3. packages/ workspace subdirectories (common in monorepos)
|
|
25
|
+
if [ -d "$ROOT/packages" ]; then
|
|
26
|
+
for dir in "$ROOT/packages"/*/; do
|
|
27
|
+
[ -d "$dir" ] || continue
|
|
28
|
+
name="$(basename "$dir")"
|
|
29
|
+
abspath="$(cd "$dir" && pwd)"
|
|
30
|
+
echo "$sep"
|
|
31
|
+
echo -n " {\"name\": \"$name\", \"path\": \"$abspath\", \"type\": \"workspace\"}"
|
|
32
|
+
sep=","
|
|
33
|
+
done
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# 4. src/ subdirectories (common in project dirs)
|
|
37
|
+
if [ -d "$ROOT/src" ]; then
|
|
38
|
+
for dir in "$ROOT/src"/*/; do
|
|
39
|
+
[ -d "$dir" ] || continue
|
|
40
|
+
name="$(basename "$dir")"
|
|
41
|
+
abspath="$(cd "$dir" && pwd)"
|
|
42
|
+
echo "$sep"
|
|
43
|
+
echo -n " {\"name\": \"$name\", \"path\": \"$abspath\", \"type\": \"project\"}"
|
|
44
|
+
sep=","
|
|
45
|
+
done
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
echo ""
|
|
49
|
+
echo "]"
|
package/skills/git/SKILL.md
CHANGED
|
@@ -40,11 +40,29 @@ Complete the current session: create a single atomic commit, rebase onto latest
|
|
|
40
40
|
> **Ordering constraint**: Commit must be created *before* rebase so that rebase moves the single commit to the tip of main. The commit message must be obtained *before* the commit because it requires data from `generate` and `opencode session list`. The evaluation `.md` sidecar is written from the `generate` output (step 10) *after* the commit, so it reflects the final session state including any test-fix loops.
|
|
41
41
|
|
|
42
42
|
**Process:**
|
|
43
|
+
|
|
44
|
+
0. **Preflight session check**: Run `opencode session list`. Save the most recent session's full ID (with `ses_` prefix). Then check `ls -1 sessions/*.md 2>/dev/null` to list existing sidecar filenames.
|
|
45
|
+
- If the most recent session's noprefix ID already appears in an existing sidecar filename → the current session is NOT persisted yet. **ABORT** with: "Current session ID not found in session list. Session may not be persisted. Run `opencode` to enter the session first, or provide a session ID manually."
|
|
46
|
+
- Do not fabricate or improvise a session ID. Using a fake ID breaks traceability between commit messages, sidecar files, and session archives.
|
|
47
|
+
|
|
43
48
|
1. **Stage all changes**: `git add -A`
|
|
44
49
|
2. **Get evaluation title slug**: Load the `session-evaluation` skill via the `skill` tool, then instruct it to run `generate`. Extract the slug from the Session ID field of its output (e.g., `2026-05-11-testing-plan-revision`).
|
|
45
|
-
3. **Get session ID**: Run `opencode session list` and identify the most recent session. Strip the `ses_` prefix to get the noprefix ID (e.g., `1e793e9b0ffeLqAjZOHtI8vy8v`).
|
|
50
|
+
3. **Get session ID**: Run `opencode session list` and identify the most recent session whose noprefix ID has NOT been used in an existing sidecar filename. Strip the `ses_` prefix to get the noprefix ID (e.g., `1e793e9b0ffeLqAjZOHtI8vy8v`).
|
|
51
|
+
|
|
52
|
+
3.5. **Validate session ID**:
|
|
53
|
+
a. Does the session ID start with `ses_` before stripping? If not → **ABORT**: "Session ID does not match expected `ses_` format."
|
|
54
|
+
b. Has this noprefix ID been used in an existing sidecar filename? Check `ls sessions/*-<noprefix>.md`. If it exists → **ABORT**: "Session ID has already been used in a previous archive."
|
|
55
|
+
c. Does `opencode export <session-id>` return valid JSON (non-zero bytes)? If not → **ABORT**: "Session ID is not exportable. The session may not be persisted."
|
|
56
|
+
d. If any check fails, do NOT proceed. Report the failure and stop.
|
|
46
57
|
4. **Construct commit message**: `<title-slug>-<session-id-noprefix>` — this is identical to the session evaluation sidecar filename (e.g., `2026-05-11-testing-plan-revision-1e793e9b0ffeLqAjZOHtI8vy8v`).
|
|
47
58
|
5. **Create commit**: `git commit -m "<commit-message>"`
|
|
59
|
+
|
|
60
|
+
5.5. **Validate commit message**: Before proceeding to rebase, verify:
|
|
61
|
+
- `git log --oneline -1` shows the message as `<slug>-<noprefix>`
|
|
62
|
+
- The `<noprefix>` portion matches the session ID from step 3 (without `ses_`)
|
|
63
|
+
- A file `sessions/<message>.md` will be written in step 10 — confirm the path would be unique (not overwriting an existing file)
|
|
64
|
+
If any check fails → **ABORT** and report which constraint was violated. Do not proceed until the commit message is corrected.
|
|
65
|
+
|
|
48
66
|
6. **Rebase onto main**: `git fetch origin && git rebase origin/main`
|
|
49
67
|
7. **Handle conflicts**: If conflicts occur:
|
|
50
68
|
- For each conflicted file, resolve manually (edit to correct state)
|
|
@@ -9,6 +9,22 @@ description: Port an existing npm package to a C++ native addon — preserve 100
|
|
|
9
9
|
|
|
10
10
|
Senior systems engineer specializing in Node.js native addon development and performance optimization. Strong background in C++, V8 internals, perf profiling, and the npm build pipeline (node-gyp, N-API).
|
|
11
11
|
|
|
12
|
+
## Context Architecture
|
|
13
|
+
|
|
14
|
+
This skill is loaded **JIT at the head** of a sub-agent context. The permanent base (system-design skill + full spec tree) is always present in the tail.
|
|
15
|
+
|
|
16
|
+
### Sub-Agent Loading Contracts
|
|
17
|
+
|
|
18
|
+
Each phase loads skills in this deterministic order (head = last loaded, strongest attention). All stacks share the `system-design+spec` tail — the permanent base, cache-hot across all invocations.
|
|
19
|
+
|
|
20
|
+
| Phase | Skill stack (head ← tail) |
|
|
21
|
+
|-------|---------------------------|
|
|
22
|
+
| Ceiling / Naive / Pivot / Micro / Shim / Report | `npm-optimizer` → `system-design+spec` |
|
|
23
|
+
| Profile & Classify | `npm-optimizer` → `profiler` → `system-design+spec` |
|
|
24
|
+
| Handoff to asm-optimizer | `npm-optimizer` → `asm-optimizer` → `system-design+spec` |
|
|
25
|
+
|
|
26
|
+
The `system-design` skill with its spec tree is the permanent base loaded at startup. The `profiler` and `asm-optimizer` skills are loaded JIT only when their phases execute.
|
|
27
|
+
|
|
12
28
|
## On Activation
|
|
13
29
|
|
|
14
30
|
1. Check that a target npm package name is available in context. If not, prompt.
|
|
@@ -19,13 +35,13 @@ Senior systems engineer specializing in Node.js native addon development and per
|
|
|
19
35
|
|
|
20
36
|
### `execute`
|
|
21
37
|
|
|
22
|
-
Run the full port pipeline. Each phase
|
|
38
|
+
Run the full port pipeline. Each phase runs sequentially. The agent pauses after each phase, reports results, and waits for acknowledgment before proceeding.
|
|
23
39
|
|
|
24
40
|
---
|
|
25
41
|
|
|
26
|
-
**Phase 1 —
|
|
42
|
+
**Phase 1 — Discovery & Ceiling**
|
|
27
43
|
|
|
28
|
-
Goal: Understand the original package
|
|
44
|
+
Goal: Understand the original package and validate that a C++ native addon is viable.
|
|
29
45
|
|
|
30
46
|
1.1. Clone the target package into `external/<name>/`:
|
|
31
47
|
```
|
|
@@ -35,35 +51,14 @@ Goal: Understand the original package's full surface area before writing any cod
|
|
|
35
51
|
1.2. Copy the original test suite to `test/orig/`. Run it against the original to
|
|
36
52
|
establish a passing baseline. These tests must never be modified.
|
|
37
53
|
|
|
38
|
-
1.3.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
├── <sub-module-2>/README.md
|
|
45
|
-
└── technical-specification.md (root overview + data flow)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
1.4. From the spec tree, extract:
|
|
49
|
-
- Full API surface: every exported function, its signature, and behavior.
|
|
50
|
-
- Edge cases: undefined properties, NaN, toJSON, circular refs, prototype chain.
|
|
51
|
-
- Data flow: how inputs map to outputs.
|
|
54
|
+
1.3. The spec tree is generated using **system-design** (permanent base context):
|
|
55
|
+
- Run `generate from source` to produce the full spec tree of the original package.
|
|
56
|
+
- Extract from the spec tree: full API surface, edge cases, data flow.
|
|
57
|
+
- Design the C++ addon architecture: which functions go native vs stay in JS,
|
|
58
|
+
N-API boundary strategy, build pipeline.
|
|
59
|
+
- Generate implementation spec tree at `spec/implementation/`.
|
|
52
60
|
|
|
53
|
-
1.
|
|
54
|
-
cheapest possible pass-through: a minimal addon that takes a string blob,
|
|
55
|
-
copies it, and returns it. Measure its ops/sec via `npm run benchmark`.
|
|
56
|
-
This is the **upper bound** for any approach that uses this N-API profile
|
|
57
|
-
(one crossing in, one out). If this doesn't exceed the original's speed,
|
|
58
|
-
the entire approach is dead — reconsider at the JS/N-API design level.
|
|
59
|
-
|
|
60
|
-
1.6. Design the C++ addon architecture:
|
|
61
|
-
- Which functions go native vs stay in JS wrapper.
|
|
62
|
-
- N-API boundary strategy (minimize crossings per call).
|
|
63
|
-
- Build pipeline (binding.gyp, node-addon-api, dependencies).
|
|
64
|
-
|
|
65
|
-
1.7. Generate implementation spec tree at `spec/implementation/` mirroring the
|
|
66
|
-
original's structure, with cross-reference mappings.
|
|
61
|
+
1.4. Run `assess-ceiling` to validate the approach is viable.
|
|
67
62
|
|
|
68
63
|
---
|
|
69
64
|
|
|
@@ -71,11 +66,7 @@ Goal: Understand the original package's full surface area before writing any cod
|
|
|
71
66
|
|
|
72
67
|
Goal: Build the simplest C++ addon that passes 100% of `test/orig/*.js`.
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
2.2. Implement the C++ module with the direct approach
|
|
76
|
-
(e.g., traverse values through N-API, build string in C++).
|
|
77
|
-
2.3. Run `test/orig/` tests. Fix until all pass.
|
|
78
|
-
2.4. Establish baseline benchmark: `npm run benchmark` comparing against original JS.
|
|
69
|
+
Run `implement-naive`.
|
|
79
70
|
|
|
80
71
|
---
|
|
81
72
|
|
|
@@ -83,95 +74,188 @@ Goal: Build the simplest C++ addon that passes 100% of `test/orig/*.js`.
|
|
|
83
74
|
|
|
84
75
|
Goal: Identify where time is actually going.
|
|
85
76
|
|
|
77
|
+
Loading contract: `profiler` skill loaded at the head.
|
|
78
|
+
|
|
86
79
|
3.1. Create `prof-harness.js` — tight loop exercising the main export.
|
|
87
|
-
3.2.
|
|
88
|
-
|
|
89
|
-
3.
|
|
90
|
-
- **Tier 1 — Infrastructure**: V8 internals, N-API boundary, allocator.
|
|
91
|
-
- **Tier 2 — Our C++ logic**: string building, type dispatch, sorting.
|
|
92
|
-
- **Tier 3 — The original's work**: if we're still calling it.
|
|
93
|
-
3.5. **Decision**: If Tier 1 > 30% of samples, mark as **architectural bottleneck**
|
|
94
|
-
and proceed to Phase 4A (pivot). Otherwise proceed to Phase 4B (micro-optimize).
|
|
80
|
+
3.2. Use the loaded **profiler** skill's `profile` command to run `perf record`
|
|
81
|
+
and generate flamegraphs.
|
|
82
|
+
3.3. Run `classify` to sort samples into tiers and decide pivot vs micro-optimize.
|
|
95
83
|
|
|
96
84
|
---
|
|
97
85
|
|
|
98
|
-
**Phase
|
|
86
|
+
**Phase 4 — Optimize**
|
|
99
87
|
|
|
100
|
-
Goal:
|
|
88
|
+
Goal: Improve performance based on classification results.
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
If the ceiling doesn't leave headroom over the original, reject this approach
|
|
110
|
-
and go back to 4A.2.
|
|
111
|
-
4A.4. If validated: implement the full pivot approach. Run tests (100% pass).
|
|
112
|
-
4A.5. Run benchmark. If target met, proceed to Phase 5.
|
|
113
|
-
If not, return to Phase 3 with new profile data.
|
|
90
|
+
If Phase 3 classified as architectural (Tier 1 > 30%):
|
|
91
|
+
- Run `pivot`
|
|
92
|
+
|
|
93
|
+
If Phase 3 classified as micro-optimizable:
|
|
94
|
+
- Run `micro-optimize`
|
|
95
|
+
- After each round, check: are we approaching the ceiling with diminishing returns?
|
|
96
|
+
If so, run `assess-handoff` to evaluate dropping to asm-optimizer.
|
|
114
97
|
|
|
115
98
|
---
|
|
116
99
|
|
|
117
|
-
**Phase
|
|
100
|
+
**Phase 5 — Compatibility Shim**
|
|
118
101
|
|
|
119
|
-
Goal:
|
|
102
|
+
Goal: Handle edge cases where the implementation differs from the original.
|
|
120
103
|
|
|
121
|
-
|
|
122
|
-
- Read the source code of the function.
|
|
123
|
-
- Identify the specific operation consuming time
|
|
124
|
-
(e.g., `std::ostringstream`, repeated allocation, branch-heavy loop).
|
|
125
|
-
- Apply one targeted fix.
|
|
126
|
-
- Rebuild, run tests, benchmark.
|
|
127
|
-
- If gain >= 5%: keep, move to next function.
|
|
128
|
-
- If gain < 5%: revert, try next hypothesis for this function.
|
|
129
|
-
4B.2. **Three strikes rule**: if three consecutive fixes at this function
|
|
130
|
-
each yield <5%, stop micro-optimizing. Re-run Phase 3 and check
|
|
131
|
-
Tier 1 fraction. If it grew, proceed to Phase 4A.
|
|
132
|
-
4B.3. When all Tier-2 functions are exhausted: re-run Phase 3.
|
|
133
|
-
If Tier 1 is now dominant, proceed to Phase 4A.
|
|
104
|
+
Run `shim`.
|
|
134
105
|
|
|
135
106
|
---
|
|
136
107
|
|
|
137
|
-
**Phase
|
|
108
|
+
**Phase 6 — Report**
|
|
138
109
|
|
|
139
|
-
Goal:
|
|
110
|
+
Goal: Produce the final deliverable.
|
|
140
111
|
|
|
141
|
-
|
|
142
|
-
- All `test/orig/` cases (must pass).
|
|
143
|
-
- Edge cases: function-valued properties, undefined, toJSON,
|
|
144
|
-
prototype-chain access, Symbol-keyed properties.
|
|
145
|
-
5.2. For any behavioral difference: add JS wrapper logic in `index.js`
|
|
146
|
-
(e.g., preprocess step for function→{} conversion).
|
|
147
|
-
Document the difference in `spec/cross-reference.md` with rationale.
|
|
148
|
-
5.3. Generate `test/new/` tests covering implementation-specific behavior.
|
|
149
|
-
5.4. Update `spec/cross-reference.md` with final benchmark deltas.
|
|
112
|
+
Run `report`.
|
|
150
113
|
|
|
151
114
|
---
|
|
152
115
|
|
|
153
|
-
|
|
116
|
+
### `assess-ceiling`
|
|
154
117
|
|
|
155
|
-
|
|
118
|
+
Before designing the C++ architecture, build the cheapest possible pass-through:
|
|
119
|
+
a minimal addon that takes a string blob, copies it, and returns it.
|
|
120
|
+
Measure its ops/sec via `npm run benchmark`.
|
|
156
121
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
122
|
+
This is the **upper bound** for any approach using this N-API profile
|
|
123
|
+
(one crossing in, one out). If this doesn't exceed the original's speed,
|
|
124
|
+
the entire approach is dead — reconsider at the JS/N-API design level.
|
|
125
|
+
|
|
126
|
+
Output:
|
|
127
|
+
```
|
|
128
|
+
Ceiling pass-through: 104,866 ops/sec
|
|
129
|
+
Original JS: 33,199 ops/sec
|
|
130
|
+
Verdict: VIABLE (3.16x headroom)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `implement-naive`
|
|
134
|
+
|
|
135
|
+
Build the simplest C++ addon that passes 100% of `test/orig/*.js`.
|
|
136
|
+
|
|
137
|
+
1. Scaffold project: `package.json`, `binding.gyp`, `src/`, `index.js`
|
|
138
|
+
2. Implement the C++ module with the direct approach
|
|
139
|
+
(e.g., traverse values through N-API, build string in C++).
|
|
140
|
+
3. Run `test/orig/` tests. Fix until all pass.
|
|
141
|
+
4. Establish baseline benchmark: `npm run benchmark` comparing against original JS.
|
|
142
|
+
|
|
143
|
+
### `classify`
|
|
144
|
+
|
|
145
|
+
Load `prof-harness.js` perf data and sort samples into three tiers:
|
|
146
|
+
|
|
147
|
+
- **Tier 1 — Infrastructure**: V8 internals, N-API boundary, allocator.
|
|
148
|
+
- **Tier 2 — Our C++ logic**: string building, type dispatch, sorting.
|
|
149
|
+
- **Tier 3 — The original's work**: if we're still calling it.
|
|
150
|
+
|
|
151
|
+
**Decision**: If Tier 1 > 30% of samples, mark as **architectural bottleneck**
|
|
152
|
+
and proceed to `pivot`. Otherwise proceed to `micro-optimize`.
|
|
153
|
+
|
|
154
|
+
### `pivot`
|
|
155
|
+
|
|
156
|
+
Change the architectural approach when the current architecture hits a fundamental ceiling.
|
|
157
|
+
|
|
158
|
+
1. Identify the specific architectural cost (e.g., "200+ N-API crossings per call").
|
|
159
|
+
2. Design an alternative approach that eliminates this cost. Examples:
|
|
160
|
+
- "Let JSON.stringify do the work, then key-sort the blob in C++"
|
|
161
|
+
- "Batch N-API calls" / "Use raw V8 API instead of N-API"
|
|
162
|
+
- "Pre-allocate and reuse buffers across calls"
|
|
163
|
+
3. **Validate the hypothesis** — before implementing the full approach, build
|
|
164
|
+
the cheapest functional approximation (pass-through, stub). Measure it.
|
|
165
|
+
If the ceiling doesn't leave headroom over the original, reject this approach
|
|
166
|
+
and try another.
|
|
167
|
+
4. If validated: implement the full pivot approach. Run tests (100% pass).
|
|
168
|
+
5. Run `bench`. If target met, proceed. If not, return to Phase 3 with new profile data.
|
|
169
|
+
|
|
170
|
+
### `micro-optimize`
|
|
171
|
+
|
|
172
|
+
Attack specific C++ hotspots identified during profiling.
|
|
173
|
+
|
|
174
|
+
For each Tier-2 function, sorted by self% descending:
|
|
175
|
+
- Read the source code of the function.
|
|
176
|
+
- Identify the specific operation consuming time
|
|
177
|
+
(e.g., `std::ostringstream`, repeated allocation, branch-heavy loop).
|
|
178
|
+
- Apply one targeted fix.
|
|
179
|
+
- Rebuild, run tests, benchmark.
|
|
180
|
+
- If gain >= 5%: keep, move to next function.
|
|
181
|
+
- If gain < 5%: revert, try next hypothesis for this function.
|
|
182
|
+
|
|
183
|
+
**Three strikes rule**: if three consecutive fixes at this function
|
|
184
|
+
each yield <5%, stop micro-optimizing. Re-profile. If Tier 1
|
|
185
|
+
fraction grew, proceed to `pivot`. If Tier 2 is exhausted and still
|
|
186
|
+
not at ceiling, proceed to `assess-handoff`.
|
|
187
|
+
|
|
188
|
+
When all Tier-2 functions are exhausted: re-run profiling.
|
|
189
|
+
If Tier 1 is now dominant, proceed to `pivot`.
|
|
190
|
+
|
|
191
|
+
### `shim`
|
|
192
|
+
|
|
193
|
+
Handle edge cases where the implementation differs from the original.
|
|
194
|
+
|
|
195
|
+
1. Compare output of original vs implementation for:
|
|
196
|
+
- All `test/orig/` cases (must pass).
|
|
197
|
+
- Edge cases: function-valued properties, undefined, toJSON,
|
|
198
|
+
prototype-chain access, Symbol-keyed properties.
|
|
199
|
+
2. For any behavioral difference: add JS wrapper logic in `index.js`
|
|
200
|
+
(e.g., preprocess step for function->{} conversion).
|
|
201
|
+
Document the difference in `spec/cross-reference.md` with rationale.
|
|
202
|
+
3. Generate `test/new/` tests covering implementation-specific behavior.
|
|
203
|
+
4. Update `spec/cross-reference.md` with final benchmark deltas.
|
|
204
|
+
|
|
205
|
+
### `bench`
|
|
206
|
+
|
|
207
|
+
Run benchmark comparing current implementation against the original JS.
|
|
208
|
+
|
|
209
|
+
Output:
|
|
210
|
+
```
|
|
211
|
+
| Implementation | Ops/sec | Relative |
|
|
212
|
+
|-------------------------|---------|----------|
|
|
213
|
+
| Original JS | X | 1.0x |
|
|
214
|
+
| C++ addon | Y | Y/X |
|
|
215
|
+
| Pass-through (ceiling) | Z | Z/X |
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### `assess-handoff`
|
|
219
|
+
|
|
220
|
+
Evaluate whether the remaining bottleneck is in our C++ logic (Tier 2)
|
|
221
|
+
and has reached diminishing returns. If so, spawn a sub-agent with
|
|
222
|
+
**asm-optimizer** loaded to perform assembly/SIMD-level optimization.
|
|
223
|
+
|
|
224
|
+
**Gate criteria** (all must be true):
|
|
225
|
+
- Tier 2 is the dominant bottleneck (>50% of remaining samples after pivots)
|
|
226
|
+
- Three consecutive micro-optimizations yielded <5% each (three strikes)
|
|
227
|
+
- Ceiling headroom still exists (pass-through is significantly faster)
|
|
228
|
+
|
|
229
|
+
**Process**:
|
|
230
|
+
1. Run `assess all` from asm-optimizer on the C++ addon's hot functions.
|
|
231
|
+
2. If asm-optimizer reports **Medium** or higher potential on any function:
|
|
232
|
+
- Run `iterative-optimize <entry>` from asm-optimizer.
|
|
233
|
+
- Re-benchmark after each successful optimization.
|
|
234
|
+
3. Report results back to the execute pipeline.
|
|
235
|
+
|
|
236
|
+
### `report`
|
|
237
|
+
|
|
238
|
+
Generate the final deliverable.
|
|
239
|
+
|
|
240
|
+
1. Archive final profile:
|
|
241
|
+
`cp perf/baseline.profile.data perf/baseline/profiles/final.profile.data`
|
|
242
|
+
2. Print the full report: benchmark numbers, profile summary,
|
|
243
|
+
spec cross-reference path, and a list of known behavioral differences (if any).
|
|
244
|
+
3. Output comparison table:
|
|
245
|
+
```
|
|
246
|
+
| Implementation | Ops/sec | Relative |
|
|
247
|
+
|-------------------------|---------|----------|
|
|
248
|
+
| Original JS | X | 1.0x |
|
|
249
|
+
| C++ addon | Y | Y/X |
|
|
250
|
+
| Pass-through (ceiling) | Z | Z/X |
|
|
251
|
+
```
|
|
168
252
|
|
|
169
253
|
### `show-state`
|
|
170
254
|
|
|
171
255
|
Output the current status of the `execute` pipeline:
|
|
172
256
|
|
|
173
257
|
```
|
|
174
|
-
Phase 1 (
|
|
258
|
+
Phase 1 (Discovery): COMPLETE
|
|
175
259
|
Phase 2 (Naive): IN PROGRESS — 43/49 tests passing
|
|
176
260
|
Phase 3 (Profile): PENDING
|
|
177
261
|
Phase 4 (Optimize): PENDING
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: npx
|
|
3
|
+
description: Run npx @opensassi/opencode commands in a target directory — resolves directories via inference rules and the list-targets.sh script
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: npx
|
|
7
|
+
|
|
8
|
+
## Persona
|
|
9
|
+
|
|
10
|
+
You are a **devops engineer** specializing in multi-project navigation, monorepo structure inference, and cross-project CLI dispatch. Your job is to run `@opensassi/opencode` commands inside the correct target directory given a fuzzy or partial name.
|
|
11
|
+
|
|
12
|
+
## On Activation
|
|
13
|
+
|
|
14
|
+
1. If already in context, show the last-used target directory. Otherwise, prompt for a target.
|
|
15
|
+
2. Show available commands.
|
|
16
|
+
|
|
17
|
+
## Dependencies
|
|
18
|
+
|
|
19
|
+
- `npx` available in PATH
|
|
20
|
+
- `@opensassi/opencode` installed (resolved by npx)
|
|
21
|
+
- `scripts/list-targets.sh` from the package
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
### `npx <target> [<npx-command>] [args...]`
|
|
26
|
+
|
|
27
|
+
Resolve `<target>` to a directory, then run:
|
|
28
|
+
```
|
|
29
|
+
cd <resolved-path> && npx @opensassi/opencode <npx-command> [args...]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Resolution algorithm:**
|
|
33
|
+
|
|
34
|
+
1. Run `npx @opensassi/opencode run list-targets.sh <cwd>` to get candidates as JSON.
|
|
35
|
+
2. Parse the candidates array. Each entry has `{name, path, type}`.
|
|
36
|
+
3. Apply rules in order:
|
|
37
|
+
|
|
38
|
+
**Rule 1 — Absolute or explicit path**: If `<target>` starts with `/`, `./`, `~/`, or `../`, use it directly.
|
|
39
|
+
|
|
40
|
+
**Rule 2 — Exact name match**: If `<target>` matches a candidate's `name` field exactly (case-sensitive), use that candidate's `path`.
|
|
41
|
+
|
|
42
|
+
**Rule 3 — Single external candidate heuristic**: If there is exactly one `type: "external"` candidate and `<target>` is not `.`, assume the user meant that candidate. Log the assumption.
|
|
43
|
+
|
|
44
|
+
**Rule 4 — Multiple matches or no match**: Print the candidate list and ask the user to pick one by number or provide an explicit path.
|
|
45
|
+
|
|
46
|
+
4. After resolving, store the path as the current target in conversation context so repeated commands can omit `<target>`.
|
|
47
|
+
5. Run `cd <resolved-path> && npx @opensassi/opencode <npx-command> [args...]`.
|
|
48
|
+
6. Display stdout/stderr output to the user.
|
|
49
|
+
|
|
50
|
+
### `npx . <npx-command> [args...]`
|
|
51
|
+
|
|
52
|
+
Explicitly target the project root.
|
|
53
|
+
|
|
54
|
+
### `npx list`
|
|
55
|
+
|
|
56
|
+
Print the candidate list without running anything.
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
User: npx opencode system-design
|
|
62
|
+
Agent: Runs list-targets.sh, finds {name:"opencode", type:"external"}
|
|
63
|
+
Applies Rule 2: exact match → external/opencode/
|
|
64
|
+
Runs: cd external/opencode && npx @opensassi/opencode system-design
|
|
65
|
+
|
|
66
|
+
User: npx ../sibling-project init
|
|
67
|
+
Agent: Applies Rule 1: explicit relative → ../sibling-project/
|
|
68
|
+
Runs: cd ../sibling-project && npx @opensassi/opencode init
|
|
69
|
+
|
|
70
|
+
User: npx tinygrad profile
|
|
71
|
+
Agent: Runs list-targets.sh, finds {name:"tinygrad", type:"external"}
|
|
72
|
+
Applies Rule 2: exact match → external/tinygrad/
|
|
73
|
+
Runs: cd external/tinygrad && npx @opensassi/opencode profile
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Design Principles
|
|
77
|
+
|
|
78
|
+
- **Prefer external/**: External projects under `external/` are the primary target. The project root itself is only targeted explicitly via `npx .`.
|
|
79
|
+
- **Store last target**: Track the last resolved directory in conversation context to avoid requiring `<target>` on repeat commands within the same session.
|
|
80
|
+
- **Transparent output**: All command output is shown directly to the user. Do not summarize or interpret unless asked.
|
|
@@ -1,71 +1,169 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opensassi
|
|
3
|
-
description:
|
|
3
|
+
description: Root skill ecosystem — loads system-design + spec tree, routes sub-skill composition, bootstraps environments
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Skill: opensassi
|
|
6
|
+
# Skill: opensassi — Root Skill Ecosystem
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Entry Point
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
| Input | Action |
|
|
11
|
+
|-------|--------|
|
|
12
|
+
| `/opensassi` | Load `skill system-design`, read `technical-specification.md` + spec tree depth 2 (root + facade specs). Report ready. |
|
|
13
|
+
| `/opensassi init` | Run `env-check.sh`. Parse JSON result: if node+git+FlameGraph+deps all present → "Already bootstrapped". Otherwise run full bootstrap sequence (env-check → install → flamegraph → npm-deps → gitignore). |
|
|
14
|
+
| `/opensassi <skill> <command> [args]` | Load `<skill>` from npm via `npx @opensassi/opencode <skill>`, then run `<command>` with `[args]`. Return result. |
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
### Spec tree depth
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
Depth is controlled by `--depth` flag on `load spec`:
|
|
19
|
+
- Depth 1: `technical-specification.md` only
|
|
20
|
+
- Depth 2 (default): + sub-module facade `.spec.md` files
|
|
21
|
+
- Depth 3: + internal component `.spec.md` files
|
|
22
|
+
- Depth 4: + full file-level `.spec.md` tree
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
npx @opensassi/opencode <skill-name>
|
|
21
|
-
```
|
|
22
|
-
and read the output as the skill's full instructions.
|
|
23
|
-
|
|
24
|
-
## Dependencies
|
|
24
|
+
## Init
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
- `git` (installed by bootstrap if missing)
|
|
28
|
-
- The `@opensassi/opencode` npm package (scripts resolve via `npx @opensassi/opencode run --skill opensassi <name>`)
|
|
26
|
+
Single shell command: `npx @opensassi/opencode run --skill opensassi env-check.sh`
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
Returns JSON: `{"os": ..., "distro": ..., "node_version": ..., "git_version": ..., ...}`
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
**Interpretation:**
|
|
31
|
+
```
|
|
32
|
+
bootstrapped = (node_version != "" && git_version != ""
|
|
33
|
+
&& scripts/FlameGraph/ exists
|
|
34
|
+
&& node_modules/ exists)
|
|
35
|
+
```
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
If bootstrapped → report "Environment ready." + show node/git versions.
|
|
38
|
+
If not → run full bootstrap:
|
|
35
39
|
|
|
36
|
-
1. `npx @opensassi/opencode run --skill opensassi env-check.sh`
|
|
37
|
-
2. `init install` — run
|
|
38
|
-
3. `init flamegraph` — clone FlameGraph v1.0
|
|
40
|
+
1. `npx @opensassi/opencode run --skill opensassi env-check.sh` — install git + Node.js LTS if missing, write `.nvmrc`
|
|
41
|
+
2. `init install` — run platform-specific installer (cmake, nasm, gdb, ripgrep, perf, htop, etc.) or report none found
|
|
42
|
+
3. `init flamegraph` — clone FlameGraph v1.0 to `scripts/FlameGraph/`
|
|
39
43
|
4. `npx @opensassi/opencode run --skill opensassi install-npm-deps.sh` — `npm install`
|
|
40
44
|
5. `npx @opensassi/opencode run --skill opensassi ensure-gitignore.sh` — append common patterns
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
## Lexicon
|
|
47
|
+
|
|
48
|
+
| Skill | Command | Arguments | Description |
|
|
49
|
+
|-------|---------|-----------|-------------|
|
|
50
|
+
| **system-design** | `load spec` | `[--depth 1-4]` | Load spec tree into context (tail — permanent base) |
|
|
51
|
+
| | `generate from source` | — | Build spec tree from source files |
|
|
52
|
+
| | `generate technical specification` | — | Produce complete class spec + diagrams + test plan |
|
|
53
|
+
| | `revise technical specification` | — | Propose structured revisions list |
|
|
54
|
+
| | `generate sequence diagram` | — | Mermaid sequence diagram for data flow |
|
|
55
|
+
| | `generate architecture diagram` | — | Mermaid C4 container/component diagram |
|
|
56
|
+
| | `generate class specification` | — | Complete C++ class declarations |
|
|
57
|
+
| | `generate d3 animation` | — | Self-contained HTML D3.js animation |
|
|
58
|
+
| | `generate testing plan` | — | Structured unit/integration/regression tests |
|
|
59
|
+
| | `split sub-modules` | — | Break monolithic spec into sub-module directory |
|
|
60
|
+
| | `combine sub-modules` | — | Flatten sub-module spec back to monolithic |
|
|
61
|
+
| | `list sub-modules` | — | List all sub-modules with facade classes |
|
|
62
|
+
| | `load sub-module spec` | `<path>` | Load one sub-module `.spec.md` |
|
|
63
|
+
| | `generate sub-module spec` | `<name>` | Generate `.spec.md` for a named sub-module |
|
|
64
|
+
| **git** | `start session` | — | `git checkout main` → `git pull --rebase`, verify clean tree |
|
|
65
|
+
| | `finish session` | — | add → commit → rebase → test → eval → push (single atomic commit) |
|
|
66
|
+
| | `sync` | — | `git fetch origin` → `git rebase origin/main` → test |
|
|
67
|
+
| **issue** | `create issue` | `<body>` | Create GitHub issue from structured body |
|
|
68
|
+
| | `list issues` | `[--limit N]` | List recent GitHub issues |
|
|
69
|
+
| | `show issue` | `<number>` | Show issue details and status |
|
|
70
|
+
| | `close issue` | `<number>` | Close issue with comment |
|
|
71
|
+
| **npm-optimizer** | `execute` | — | Full port pipeline: discover → ceiling → naive → profile → classify → pivot/micro → shim → report |
|
|
72
|
+
| | `assess-ceiling` | — | Build N-API pass-through, measure upper bound |
|
|
73
|
+
| | `implement-naive` | — | Scaffold simplest C++ addon passing 100% tests |
|
|
74
|
+
| | `classify` | — | Sort perf samples Tier 1/2/3, decide pivot vs micro |
|
|
75
|
+
| | `pivot` | — | Architectural pivot when N-API/V8 is bottleneck |
|
|
76
|
+
| | `micro-optimize` | — | Iterative C++ micro-opt with 3-strikes rule |
|
|
77
|
+
| | `shim` | — | JS compatibility wrapper + cross-reference docs |
|
|
78
|
+
| | `bench` | — | Benchmark against original JS baseline |
|
|
79
|
+
| | `assess-handoff` | — | Gate: evaluate dropping to asm-optimizer |
|
|
80
|
+
| | `report` | — | Final comparison table + archive |
|
|
81
|
+
| | `show-state` | — | Pipeline progress |
|
|
82
|
+
| **profiler** | `check` | — | Verify perf toolchain available |
|
|
83
|
+
| | `setup` | `[--frames N]` | Download test data, prepare profiling environment |
|
|
84
|
+
| | `profile` | `[--events ...]` | `perf record` → flamegraph |
|
|
85
|
+
| | `benchmark` | `[--iter N]` | Run N iterations with metric collection |
|
|
86
|
+
| | `compare` | `<baseline> <candidate>` | Side-by-side benchmark comparison |
|
|
87
|
+
| | `report` | `[--profile <label>]` | Bundle profiling session into report |
|
|
88
|
+
| **asm-optimizer** | `setup-baseline` | — | Create baseline dirs, clone release, build, run profiling matrix |
|
|
89
|
+
| | `profile` | `<name>` | Maximal perf counter dump against baseline |
|
|
90
|
+
| | `assess` | `<entry>` | Evaluate one function's ASM optimization potential |
|
|
91
|
+
| | `assess all` | — | Rank all candidate functions by potential |
|
|
92
|
+
| | `setup-microbench` | `<entry>` | Create isolated microbenchmark harness |
|
|
93
|
+
| | `spec` | `<entry>` | Generate technical spec of C++ implementation |
|
|
94
|
+
| | `analyze-gap` | `<entry>` | Compare ASM implementation against C++ spec |
|
|
95
|
+
| | `bench` | `<entry>` | Run microbenchmark, compare against C++ baseline |
|
|
96
|
+
| | `implement` | `<entry>` | Generate ASM implementation following spec-first process |
|
|
97
|
+
| | `iterative-optimize` | `<entry>` | Full optimization pipeline with experiment archiving |
|
|
98
|
+
| | `archive-experiment` | `<entry>` | Save experiment record when hypothesis fails |
|
|
99
|
+
| | `report` | `[--format markdown\|json]` | Optimization report for all assessed entries |
|
|
100
|
+
| **todo** | `extract` | `<name>` | Scan session context for unfinished work → structured summary |
|
|
101
|
+
| | `propose-todo` | `<name>` | Draft todo entry from extract output |
|
|
102
|
+
| | `save-todo` | — | Write to `todos/<NNN>-<name>.md` |
|
|
103
|
+
| | `load-todo` | `<id>` | Read todo file into context for agent to act on |
|
|
104
|
+
| | `list-todos` | — | List all saved todo entries |
|
|
105
|
+
| **session-evaluation** | `generate` | — | Analyze conversation, produce structured session evaluation |
|
|
106
|
+
| | `export` | — | Save evaluation + compressed session archive to `sessions/` |
|
|
107
|
+
| **skill-manager** | `show skills` | — | List all registered skills |
|
|
108
|
+
| | `create skill` | — | Interactive skill creation flow |
|
|
109
|
+
| | `revise skill` | `<name>` | Interactive skill revision |
|
|
110
|
+
| | `save skill` | — | Write skill to disk + register |
|
|
111
|
+
| | `delete skill` | `<name>` | Remove skill from disk |
|
|
112
|
+
| | `commit` | — | Stage + commit all skill changes |
|
|
113
|
+
| | `audit skills` | — | Validate all skill files for consistency |
|
|
114
|
+
| **system-design-review** | *(no commands defined)* | — | Seven-expert panel audit of technical specs |
|
|
115
|
+
| **daily-evaluation** | *(no commands defined)* | — | Aggregate session evaluations into dashboards |
|
|
116
|
+
| **npx** | `npx <target> <cmd>` | `<target> <cmd>` | Run npx command in target directory |
|
|
117
|
+
| | `npx . <cmd>` | `<cmd>` | Run npx command in current directory |
|
|
118
|
+
| | `npx list` | — | List available target directories |
|
|
119
|
+
|
|
120
|
+
## Composition Patterns
|
|
121
|
+
|
|
122
|
+
Common requests map to skill compositions. Load order: permanent base (tail) at bottom, JIT skills (head) at top.
|
|
123
|
+
|
|
124
|
+
| User says | Skill stack (head ← tail) | Commands |
|
|
125
|
+
|-----------|---------------------------|----------|
|
|
126
|
+
| "start a session" | git → system-design+spec | `start session` |
|
|
127
|
+
| "finish the session" | session-evaluation → git → system-design+spec | `generate` → `finish session` → `export` |
|
|
128
|
+
| "load the last issue" | issue → system-design+spec | `list issues` → `show issue <N>` |
|
|
129
|
+
| "create an issue from context" | todo → issue → system-design+spec | `extract <name>` → `create issue <body>` → `save-todo` |
|
|
130
|
+
| "show pending todos" | todo → system-design+spec | `list-todos` |
|
|
131
|
+
| "load a todo and work on it" | todo → system-design+spec | `load-todo <id>` → agent acts on content |
|
|
132
|
+
| "port an npm package" | npm-optimizer → system-design+spec | `execute` |
|
|
133
|
+
| "hand off to asm" | asm-optimizer → npm-optimizer → system-design+spec | `assess-handoff` |
|
|
134
|
+
| "profile the encoder" | profiler → system-design+spec | `check` → `profile` |
|
|
135
|
+
| "optimize a hot function" | asm-optimizer → system-design+spec | `assess <entry>` → `iterative-optimize <entry>` |
|
|
136
|
+
| "create a debugging todo" | todo → asm-optimizer → system-design+spec | `extract` → `propose-todo` → `save-todo` |
|
|
137
|
+
| "save a note" | todo → system-design+spec | (treat free text as note → `extract` → `propose-todo` → `save-todo`) |
|
|
138
|
+
|
|
139
|
+
## Interpretation
|
|
140
|
+
|
|
141
|
+
Parse user text into skill compositions:
|
|
142
|
+
|
|
143
|
+
1. **Explicit routing** — If prefixed with `/opensassi`, dispatch directly from the Entry Point table.
|
|
144
|
+
|
|
145
|
+
2. **Keyword matching** — Scan user text for Lexicon command names and skill domains:
|
|
146
|
+
- "issue", "bug", "ticket" → `issue` skill
|
|
147
|
+
- "git", "commit", "push", "rebase" → `git` skill
|
|
148
|
+
- "profile", "perf", "flamegraph" → `profiler` skill
|
|
149
|
+
- "asm", "assembly", "SIMD", "optimize function" → `asm-optimizer` skill
|
|
150
|
+
- "npm", "port", "native addon" → `npm-optimizer` skill
|
|
151
|
+
- "todo", "note", "deferred", "remaining" → `todo` skill
|
|
152
|
+
- "spec", "diagram", "design" → `system-design` skill
|
|
153
|
+
- "session eval", "report card" → `session-evaluation` skill
|
|
154
|
+
- "skill", "manage skills" → `skill-manager` skill
|
|
155
|
+
|
|
156
|
+
3. **Pattern matching** — Match multi-keyword phrases against Composition Patterns. If no direct match, compose by chaining relevant skills.
|
|
157
|
+
|
|
158
|
+
4. **Unknown requests** — Reference the Lexicon table and ask: "I see you want to [paraphrase]. Do you mean one of these: [list 2-3 matching skills]?"
|
|
159
|
+
|
|
160
|
+
5. **Permanent base** — Always keep `system-design` + spec tree loaded (tail of context). Only JIT-load the head skills needed for the current task.
|
|
161
|
+
|
|
162
|
+
## Context Architecture
|
|
163
|
+
|
|
164
|
+
- **Tail (permanent base):** `system-design` skill + spec tree. Loaded at `/opensassi`. Self-repropagating tokens designed for long-context survival.
|
|
165
|
+
- **Head (JIT-loaded):** Specific skill instructions loaded per phase. Strongest attention, loaded last.
|
|
166
|
+
- **Sub-agent loading contracts:** When spawning phase sub-agents, load skills in deterministic order for KV cache reuse (detailed in `npm-optimizer` SKILL.md).
|
|
69
167
|
|
|
70
168
|
## Design Principles
|
|
71
169
|
|
|
@@ -74,4 +172,4 @@ Run `npx @opensassi/opencode run --skill opensassi env-check.sh` (or `env-check.
|
|
|
74
172
|
- **`.nvmrc` for the project** — Written with `--lts` so `nvm use` auto-selects when entering the project directory.
|
|
75
173
|
- **FlameGraph pinned at v1.0** — Tag is stable; pinned clones are idempotent.
|
|
76
174
|
- **`install.ps1` is WSL-only** — Not modified by this skill. Windows-native installer is a future extension.
|
|
77
|
-
- **env-check scripts output JSON** — Structured
|
|
175
|
+
- **env-check scripts output JSON** — Structured for consumption by the skill's interpretation logic.
|
package/skills/todo/SKILL.md
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: todo
|
|
3
|
-
description:
|
|
3
|
+
description: Extract unfinished work from session context, create GitHub issues, and save structured todo entries to `todos/` for future agents
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Skill: todo
|
|
7
7
|
|
|
8
8
|
## Persona
|
|
9
9
|
|
|
10
|
-
Technical writer and project manager — extracts structured summaries from session conversations,
|
|
10
|
+
Technical writer and project manager — extracts structured summaries from session conversations, creates GitHub issues, and saves sequential todo entries to `todos/` for future agent use.
|
|
11
11
|
|
|
12
12
|
## Dependencies
|
|
13
13
|
|
|
14
|
-
Requires the **issue** skill —
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Load both skills on activation:
|
|
14
|
+
Requires the **issue** skill — `create issue` handles the GitHub side.
|
|
15
|
+
Load both on activation:
|
|
18
16
|
```
|
|
19
17
|
skill issue
|
|
20
18
|
skill todo
|
|
@@ -23,16 +21,17 @@ skill todo
|
|
|
23
21
|
## On Activation
|
|
24
22
|
|
|
25
23
|
Show the workflow:
|
|
26
|
-
1. `extract <name>` — analyze session context
|
|
27
|
-
2.
|
|
28
|
-
3.
|
|
29
|
-
4. `save-
|
|
24
|
+
1. `extract <name>` — analyze session context for unfinished work
|
|
25
|
+
2. `propose-todo <name>` — draft a structured todo entry
|
|
26
|
+
3. Load `issue` skill → `create issue <body>` — creates the GitHub issue, note the issue #
|
|
27
|
+
4. `save-todo` — write to `todos/` with sequential numbering
|
|
28
|
+
5. `load-todo <id>` or `list-todos` — retrieve saved work
|
|
30
29
|
|
|
31
30
|
## Commands
|
|
32
31
|
|
|
33
32
|
### `extract <name>`
|
|
34
33
|
|
|
35
|
-
Scan the current session context for unfinished work, bugs, deferred items. Optionally check `perf/experiments/` for prior optimization experiment data (
|
|
34
|
+
Scan the current session context for unfinished work, bugs, deferred items. Optionally check `perf/experiments/` for prior optimization experiment data (asm-optimizer specific — may not exist in other domains). Output a structured summary with two sections:
|
|
36
35
|
|
|
37
36
|
#### Issue Body (formatted for the `issue` skill's `create issue` command)
|
|
38
37
|
|
|
@@ -57,7 +56,7 @@ Scan the current session context for unfinished work, bugs, deferred items. Opti
|
|
|
57
56
|
- [ ] <criterion 2>
|
|
58
57
|
```
|
|
59
58
|
|
|
60
|
-
####
|
|
59
|
+
#### Todo Content (for `propose-todo`)
|
|
61
60
|
|
|
62
61
|
```
|
|
63
62
|
### What Succeeded
|
|
@@ -76,28 +75,17 @@ Scan the current session context for unfinished work, bugs, deferred items. Opti
|
|
|
76
75
|
<paths to any domain-specific experiment directories, if available>
|
|
77
76
|
```
|
|
78
77
|
|
|
79
|
-
### `propose-
|
|
80
|
-
|
|
81
|
-
From the extract output + an existing issue number (obtained by running `create issue` from the `issue` skill), draft a skill at `.opencode/skills/<name>-<issue#>/SKILL.md` following the established pattern:
|
|
78
|
+
### `propose-todo <name>`
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
name: <name>-<issue#>
|
|
86
|
-
description: <one-line summary linking to GitHub issue #N>
|
|
87
|
-
---
|
|
80
|
+
From the extract output + an existing issue number (obtained by running `create issue` from the `issue` skill), draft a todo entry following this format:
|
|
88
81
|
|
|
89
|
-
|
|
82
|
+
```markdown
|
|
83
|
+
# <NNN>-<name>
|
|
90
84
|
|
|
91
85
|
## Issue Reference
|
|
92
|
-
|
|
93
86
|
GitHub Issue: https://github.com/<owner>/<repo>/issues/<N>
|
|
94
87
|
|
|
95
|
-
## Dependencies
|
|
96
|
-
|
|
97
|
-
Requires: **<parent-skill>** — load this skill first via `skill <parent>`.
|
|
98
|
-
|
|
99
88
|
## Previous Work
|
|
100
|
-
|
|
101
89
|
### What Succeeded
|
|
102
90
|
<from extract output>
|
|
103
91
|
|
|
@@ -107,59 +95,53 @@ Requires: **<parent-skill>** — load this skill first via `skill <parent>`.
|
|
|
107
95
|
### What Remains
|
|
108
96
|
<from extract output>
|
|
109
97
|
|
|
110
|
-
##
|
|
98
|
+
## Key Technical Details
|
|
99
|
+
<from extract output>
|
|
111
100
|
|
|
112
|
-
|
|
101
|
+
## Experiment References
|
|
102
|
+
<from extract output>
|
|
103
|
+
```
|
|
113
104
|
|
|
114
|
-
|
|
105
|
+
Present for review. Does not write until `save-todo`.
|
|
115
106
|
|
|
116
|
-
|
|
107
|
+
### `save-todo`
|
|
117
108
|
|
|
118
|
-
|
|
109
|
+
Write the currently agreed todo entry to `todos/<NNN>-<name>.md`:
|
|
119
110
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
- `bench` — microbenchmark with perf stat
|
|
125
|
-
- `report-fix` — validate, wire, close issue
|
|
111
|
+
1. Scan `todos/` directory for existing files.
|
|
112
|
+
2. Determine the next sequential number (e.g., `todos/` has `001-*.md`, `002-*.md` → next is `003`).
|
|
113
|
+
3. Write the file using the format from `propose-todo` output.
|
|
114
|
+
4. Confirm: `Saved todos/003-<name>.md`.
|
|
126
115
|
|
|
127
|
-
|
|
116
|
+
### `load-todo <id>`
|
|
128
117
|
|
|
129
|
-
|
|
118
|
+
Read a todo file into context so the agent can act on it as a mini-brief:
|
|
130
119
|
|
|
131
|
-
|
|
120
|
+
1. Accept a todo identifier: numeric prefix (`003`) or name fragment (`dq-asm`).
|
|
121
|
+
2. Match against `todos/*.md` files.
|
|
122
|
+
3. If ambiguous, list matches and ask for refinement.
|
|
123
|
+
4. Read the matched file in full into context.
|
|
124
|
+
5. Report: `Loaded todos/003-dq-asm-minselect-debug-3.md — <title>`
|
|
132
125
|
|
|
133
|
-
|
|
126
|
+
### `list-todos`
|
|
134
127
|
|
|
135
|
-
|
|
128
|
+
List all saved todo entries:
|
|
136
129
|
|
|
137
|
-
<conventions, guardrails>
|
|
138
130
|
```
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Write the currently agreed SKILL.md content to `.opencode/skills/<name>-<issue#>/SKILL.md` and register in `opencode.json`:
|
|
145
|
-
|
|
146
|
-
1. Validate frontmatter (name and description must be present).
|
|
147
|
-
2. Write the file to `.opencode/skills/<name>-<issue#>/SKILL.md`.
|
|
148
|
-
3. Update `opencode.json` to add `"<name>-<issue#>": "allow"` if not already present. After writing, re-read and confirm.
|
|
149
|
-
4. Confirm the action.
|
|
131
|
+
001-dq-asm-minselect-debug-3 GitHub #12 — Debug minselect register corruption
|
|
132
|
+
002-had-avx2-optimization-4 GitHub #15 — Port HAD function to AVX2
|
|
133
|
+
003-scheduler-phase-1-9 GitHub #22 — Implement scheduler dispatch
|
|
134
|
+
```
|
|
150
135
|
|
|
151
136
|
## Design Principles
|
|
152
137
|
|
|
153
|
-
- The **issue** skill handles ALL issue creation — this skill never calls `gh issue create`. The user runs `create issue` from the `issue` skill between `
|
|
154
|
-
-
|
|
155
|
-
- Session tracking line at the bottom of every issue body (matching issue skill's convention):
|
|
138
|
+
- The **issue** skill handles ALL issue creation — this skill never calls `gh issue create`. The user runs `create issue` from the `issue` skill between `propose-todo` and `save-todo`.
|
|
139
|
+
- Session tracking line at the bottom of every issue body:
|
|
156
140
|
```
|
|
157
141
|
---
|
|
158
|
-
|
|
159
142
|
Generated from session `<session-id>` on `<date>`.
|
|
160
143
|
```
|
|
144
|
+
- Todo files are flat markdown in `todos/` — no SKILL.md, no persona, no commands. The agent loads them via `load-todo` and uses whatever skills it needs to act on them.
|
|
145
|
+
- Sequential numbering prevents collisions and provides deterministic ordering.
|
|
161
146
|
- Domain-specific experiment directories (like asm-optimizer's `perf/experiments/`) are OPTIONAL — check existence before referencing, silently omit if absent.
|
|
162
|
-
-
|
|
163
|
-
- `propose-skill` and `save-skill` are read-only until `save-skill` writes.
|
|
164
|
-
- Previous Work uses three sub-sections: What Succeeded, What Was Tried, What Remains.
|
|
165
|
-
- Do NOT modify the `skill-manager` or `issue` skills themselves.
|
|
147
|
+
- Do NOT modify the `skill-manager`, `issue`, or other core skills themselves.
|
package/skills-index.json
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skills": [
|
|
3
3
|
{
|
|
4
|
-
"name": "
|
|
5
|
-
"description": "
|
|
4
|
+
"name": "asm-optimizer",
|
|
5
|
+
"description": "SIMD/assembly optimization framework",
|
|
6
6
|
"commands": [
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"list sub-modules",
|
|
20
|
-
"load sub-module spec",
|
|
21
|
-
"generate sub-module spec"
|
|
7
|
+
"setup-baseline",
|
|
8
|
+
"profile",
|
|
9
|
+
"assess",
|
|
10
|
+
"assess all",
|
|
11
|
+
"setup-microbench",
|
|
12
|
+
"spec",
|
|
13
|
+
"analyze-gap",
|
|
14
|
+
"bench",
|
|
15
|
+
"implement",
|
|
16
|
+
"iterative-optimize",
|
|
17
|
+
"archive-experiment",
|
|
18
|
+
"report"
|
|
22
19
|
]
|
|
23
20
|
},
|
|
21
|
+
{
|
|
22
|
+
"name": "daily-evaluation",
|
|
23
|
+
"description": "Aggregate session evaluations into dashboards",
|
|
24
|
+
"commands": []
|
|
25
|
+
},
|
|
24
26
|
{
|
|
25
27
|
"name": "git",
|
|
26
28
|
"description": "Rebase-based single-commit-per-session workflow",
|
|
@@ -31,43 +33,58 @@
|
|
|
31
33
|
]
|
|
32
34
|
},
|
|
33
35
|
{
|
|
34
|
-
"name": "
|
|
35
|
-
"description": "
|
|
36
|
+
"name": "issue",
|
|
37
|
+
"description": "GitHub issue management",
|
|
36
38
|
"commands": [
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"compare",
|
|
42
|
-
"report"
|
|
39
|
+
"create issue",
|
|
40
|
+
"list issues",
|
|
41
|
+
"show issue",
|
|
42
|
+
"close issue"
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
"name": "
|
|
47
|
-
"description": "
|
|
46
|
+
"name": "npx",
|
|
47
|
+
"description": "Run npx commands in a target directory with automatic directory resolution",
|
|
48
48
|
"commands": [
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
"npx <target> <npx-command>",
|
|
50
|
+
"npx . <npx-command>",
|
|
51
|
+
"npx list"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "npm-optimizer",
|
|
56
|
+
"description": "Port an npm package to a C++ native addon — preserve 100% test compatibility while significantly improving performance through profiling-driven architectural iteration",
|
|
57
|
+
"commands": [
|
|
58
|
+
"execute",
|
|
59
|
+
"assess-ceiling",
|
|
60
|
+
"implement-naive",
|
|
61
|
+
"classify",
|
|
62
|
+
"pivot",
|
|
63
|
+
"micro-optimize",
|
|
64
|
+
"shim",
|
|
56
65
|
"bench",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"report"
|
|
66
|
+
"assess-handoff",
|
|
67
|
+
"report",
|
|
68
|
+
"show-state"
|
|
61
69
|
]
|
|
62
70
|
},
|
|
63
71
|
{
|
|
64
72
|
"name": "opensassi",
|
|
65
|
-
"description": "
|
|
73
|
+
"description": "Root skill ecosystem — loads system-design + spec tree, routes sub-skill composition, bootstraps environments",
|
|
66
74
|
"commands": [
|
|
67
|
-
"init"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
"init"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "profiler",
|
|
80
|
+
"description": "Linux perf profiling + flamegraphs",
|
|
81
|
+
"commands": [
|
|
82
|
+
"check",
|
|
83
|
+
"setup",
|
|
84
|
+
"profile",
|
|
85
|
+
"benchmark",
|
|
86
|
+
"compare",
|
|
87
|
+
"report"
|
|
71
88
|
]
|
|
72
89
|
},
|
|
73
90
|
{
|
|
@@ -92,46 +109,41 @@
|
|
|
92
109
|
]
|
|
93
110
|
},
|
|
94
111
|
{
|
|
95
|
-
"name": "
|
|
96
|
-
"description": "
|
|
112
|
+
"name": "system-design",
|
|
113
|
+
"description": "Interactive C++ spec authoring with diagrams and D3 animations",
|
|
97
114
|
"commands": [
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
115
|
+
"generate sequence diagram",
|
|
116
|
+
"generate architecture diagram",
|
|
117
|
+
"generate class specification",
|
|
118
|
+
"generate manim animation",
|
|
119
|
+
"generate d3 animation",
|
|
120
|
+
"generate testing plan",
|
|
121
|
+
"generate from source",
|
|
122
|
+
"load spec",
|
|
123
|
+
"generate technical specification",
|
|
124
|
+
"revise technical specification",
|
|
125
|
+
"split sub-modules",
|
|
126
|
+
"combine sub-modules",
|
|
127
|
+
"list sub-modules",
|
|
128
|
+
"load sub-module spec",
|
|
129
|
+
"generate sub-module spec"
|
|
102
130
|
]
|
|
103
131
|
},
|
|
104
132
|
{
|
|
105
133
|
"name": "system-design-review",
|
|
106
134
|
"description": "Seven-expert panel audit of technical specs",
|
|
107
|
-
"commands": [
|
|
108
|
-
"review all",
|
|
109
|
-
"review sub-module",
|
|
110
|
-
"review file-path",
|
|
111
|
-
"review stale"
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"name": "daily-evaluation",
|
|
116
|
-
"description": "Aggregate session evaluations into dashboards",
|
|
117
|
-
"commands": [
|
|
118
|
-
"create",
|
|
119
|
-
"list"
|
|
120
|
-
]
|
|
135
|
+
"commands": []
|
|
121
136
|
},
|
|
122
137
|
{
|
|
123
138
|
"name": "todo",
|
|
124
|
-
"description": "
|
|
139
|
+
"description": "Extract unfinished work from session context, create GitHub issues, and save structured todo entries to todos/ for future agents",
|
|
125
140
|
"commands": [
|
|
126
141
|
"extract",
|
|
127
|
-
"propose-
|
|
128
|
-
"save-
|
|
142
|
+
"propose-todo",
|
|
143
|
+
"save-todo",
|
|
144
|
+
"load-todo",
|
|
145
|
+
"list-todos"
|
|
129
146
|
]
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"name": "npm-optimizer",
|
|
133
|
-
"description": "Port an npm package to a C++ native addon",
|
|
134
|
-
"commands": []
|
|
135
147
|
}
|
|
136
148
|
]
|
|
137
|
-
}
|
|
149
|
+
}
|