@neikyun/ciel 6.2.4 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/assets/.claude/settings.json +16 -3
  2. package/assets/AGENTS.md +1 -1
  3. package/assets/CLAUDE.md +5 -9
  4. package/assets/commands/ciel-audit.md +195 -59
  5. package/assets/commands/ciel-migrate.md +35 -0
  6. package/assets/commands/ciel-status.md +40 -0
  7. package/assets/commands/ciel-update.md +4 -0
  8. package/assets/dist/plugin/index.js +7 -9
  9. package/assets/platforms/opencode/.opencode/agents/ciel-critic.md +320 -483
  10. package/assets/platforms/opencode/.opencode/agents/ciel-explorer.md +114 -96
  11. package/assets/platforms/opencode/.opencode/agents/ciel-improver.md +204 -273
  12. package/assets/platforms/opencode/.opencode/agents/ciel-researcher.md +259 -270
  13. package/assets/platforms/opencode/.opencode/agents/ciel.md +1 -1
  14. package/assets/platforms/opencode/.opencode/commands/ciel-audit.md +300 -10
  15. package/assets/platforms/opencode/.opencode/commands/ciel-create-skill.md +75 -10
  16. package/assets/platforms/opencode/.opencode/commands/ciel-eval.md +71 -10
  17. package/assets/platforms/opencode/.opencode/commands/ciel-improve.md +7 -13
  18. package/assets/platforms/opencode/.opencode/commands/ciel-init.md +165 -11
  19. package/assets/platforms/opencode/.opencode/commands/ciel-migrate.md +40 -0
  20. package/assets/platforms/opencode/.opencode/commands/ciel-refresh.md +89 -13
  21. package/assets/platforms/opencode/.opencode/commands/ciel-status.md +45 -0
  22. package/assets/platforms/opencode/.opencode/commands/ciel-update.md +31 -18
  23. package/assets/platforms/opencode/.opencode/commands/ciel.md +1 -2
  24. package/assets/platforms/opencode/.opencode/plugins/ciel.ts +146 -0
  25. package/assets/platforms/opencode/AGENTS.md +2 -2
  26. package/assets/skills/ciel/SKILL.md +32 -2
  27. package/assets/skills/ciel/reference.md +33 -5
  28. package/dist/cli/claude.d.ts.map +1 -1
  29. package/dist/cli/claude.js +0 -1
  30. package/dist/cli/claude.js.map +1 -1
  31. package/dist/cli/init.d.ts.map +1 -1
  32. package/dist/cli/init.js +0 -2
  33. package/dist/cli/init.js.map +1 -1
  34. package/dist/cli/opencode.d.ts.map +1 -1
  35. package/dist/cli/opencode.js +0 -1
  36. package/dist/cli/opencode.js.map +1 -1
  37. package/dist/plugin/index.d.ts.map +1 -1
  38. package/dist/plugin/index.js +7 -9
  39. package/dist/plugin/index.js.map +1 -1
  40. package/package.json +3 -2
  41. package/assets/commands/ciel-recommend.md +0 -95
  42. package/assets/platforms/opencode/.opencode/commands/ciel-recommend.md +0 -18
@@ -1,19 +1,173 @@
1
1
  ---
2
- command: ciel-init
3
- description: Initialize or reinstall Ciel in the current project
2
+ description: ---
4
3
  subtask: false
5
4
  ---
6
5
 
7
- # /ciel-init — Initialize Ciel
6
+ ---
7
+ description: Bootstrap or repair Ciel wiring. Auto-detects platform (Claude Code, OpenCode, Cursor, etc.) and configures hooks. Preserves existing config, creates backups.
8
+ ---
9
+
10
+ # /ciel-init — Wire Ciel into Current Project
11
+
12
+ **Purpose:** Fix the #1 Ciel failure mode — hooks not firing because config is missing, has wrong paths, or platform not detected.
13
+
14
+ **Usage:** `/ciel-init [--check] [--user] [--platform=NAME]`
15
+
16
+ - `--check` — Dry-run: show what would change without writing
17
+ - `--user` — Install to user scope (~/.claude/settings.json) instead of project
18
+ - `--platform=NAME` — Force platform (claude, opencode, cursor, windsurf, codex, kilocode, ollama, lmstudio)
19
+
20
+ ---
21
+
22
+ ## Instructions
23
+
24
+ You are repairing Ciel wiring. This is deterministic — NO agent dispatch, NO research, NO pipeline.
25
+
26
+ ### Step 1: Detect Platform
27
+
28
+ Run detection in order (pick FIRST match):
29
+
30
+ 1. **Project files:**
31
+ - `./opencode.json` or `./.opencode/` → **opencode**
32
+ - `./.claude/settings.json` or `./.claude/` → **claude**
33
+ - `./.cursor/` → **cursor**
34
+ - `./.windsurf/` → **windsurf**
35
+ - `./.codex/` → **codex**
36
+ - `./.kilocode/` or `./.kilo/` → **kilocode**
37
+
38
+ 2. **CLI availability:**
39
+ - `command -v claude` → **claude**
40
+ - `command -v opencode` → **opencode**
41
+ - `command -v ollama` → **ollama**
42
+
43
+ 3. **If ambiguous:** Ask user to specify with `--platform=NAME`
44
+
45
+ ### Step 2: Find Ciel Directory
46
+
47
+ Check in order:
48
+ 1. `$CLAUDE_PLUGIN_DIR/ciel` (if env var set)
49
+ 2. `$HOME/.claude/plugins/ciel`
50
+ 3. `$HOME/.ciel`
51
+ 4. `find "$HOME" -maxdepth 5 -path '*/ciel/hooks/session-start.sh' 2>/dev/null | head -1`
52
+
53
+ If not found → Tell user to run install first:
54
+ ```bash
55
+ bash <(curl -fsSL https://raw.githubusercontent.com/KaosKyun/Ciel/main/scripts/install.sh)
56
+ ```
57
+
58
+ ### Step 3: Verify Hooks Exist
59
+
60
+ Check for 8 required hooks in `$CIEL_DIR/hooks/`:
61
+ ```
62
+ session-start.sh, user-prompt-submit.sh, pre-tool-write.sh, post-tool-write.sh,
63
+ stop.sh, subagent-stop.sh, pre-compact.sh, pre-agent-gate.sh
64
+ ```
65
+
66
+ If missing → Copy from nearest Ciel source or tell user to reinstall.
67
+
68
+ ### Step 4: Configure Platform
69
+
70
+ #### Claude Code Branch
71
+
72
+ **Config file:** `./.claude/settings.json` (project) or `$HOME/.claude/settings.json` (user)
73
+
74
+ **Before writing:**
75
+ 1. Check CWD sanity — warn if running Claude from different directory
76
+ 2. Backup existing config: `cp file.json file.json.bak-TIMESTAMP`
77
+
78
+ **Write config:**
79
+ ```json
80
+ {
81
+ "hooks": {
82
+ "SessionStart": { "command": "$CIEL_DIR/hooks/session-start.sh", "stdin": true },
83
+ "UserPromptSubmit": { "command": "$CIEL_DIR/hooks/user-prompt-submit.sh", "stdin": true },
84
+ "PreToolUse": { "command": "$CIEL_DIR/hooks/pre-tool-write.sh", "stdin": true, "matcher": "Write|Edit" },
85
+ "PostToolUse": { "command": "$CIEL_DIR/hooks/post-tool-write.sh", "stdin": true, "matcher": "Write|Edit" },
86
+ "PreCompact": { "command": "$CIEL_DIR/hooks/pre-compact.sh", "stdin": true },
87
+ "Stop": { "command": "$CIEL_DIR/hooks/stop.sh", "stdin": true }
88
+ }
89
+ }
90
+ ```
91
+
92
+ #### OpenCode Branch
93
+
94
+ **Config file:** `./opencode.json`
95
+
96
+ **Before writing:**
97
+ 1. Backup: `cp opencode.json opencode.json.bak-TIMESTAMP`
98
+ 2. Merge existing config (preserve model, provider, mcp, keybinds)
99
+
100
+ **Ensure:**
101
+ - `plugin` array contains `"./.opencode/plugins/ciel.ts"`
102
+ - `instructions` array contains `"AGENTS.md"`
103
+
104
+ **Copy files:**
105
+ - `.opencode/plugins/ciel.ts`
106
+ - `.opencode/agents/ciel-*.md` (6 files)
107
+ - `.opencode/commands/ciel-*.md` (9 files)
108
+
109
+ #### Other Platforms Branch
110
+
111
+ Install platform-specific artifacts:
112
+ - **Cursor:** `.cursor/rules/ciel.mdc`
113
+ - **Windsurf:** `.windsurf/rules/*.md`
114
+ - **Codex:** `AGENTS.md`, `.codex/hooks.json`
115
+ - **Kilocode:** `.kilocode/rules/ciel.md`, `.kilo/agents/*`
116
+ - **Ollama:** `Modelfile` (user runs `ollama create`)
117
+ - **LM Studio:** `ciel.preset.json`, `system-prompt.md`
118
+
119
+ ### Step 5: Verification
120
+
121
+ After configuration, verify:
122
+
123
+ 1. **Config file exists** at expected path
124
+ 2. **Hooks are executable:** `chmod +x "$CIEL_DIR/hooks/"*.sh`
125
+ 3. **Plugin file syntax valid** (for OpenCode: `npx tsc --noEmit`)
126
+
127
+ ### Step 6: Report
128
+
129
+ Output summary:
130
+
131
+ ```
132
+ ✓ /ciel-init completed
133
+
134
+ Platform: Claude Code
135
+ Config: /path/to/settings.json
136
+ CIEL_DIR: /path/to/ciel
137
+ Hooks: 8/8 present
138
+
139
+ Next steps:
140
+ 1. Restart Claude Code
141
+ 2. Run a test prompt — should see depth hint
142
+ 3. Make code changes — should see RELIRE reminder
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Error Handling
148
+
149
+ | Error | Action |
150
+ |-------|--------|
151
+ | Ciel directory not found | Tell user to run install script |
152
+ | Hooks missing | Try to copy from source, else reinstall |
153
+ | Config write fails | Show manual instructions |
154
+ | Platform ambiguous | Ask user to specify with --platform |
155
+ | Permission denied | Suggest running with sudo or check file permissions |
156
+
157
+ ---
158
+
159
+ ## Examples
8
160
 
9
- Installs Ciel agents, hooks, and configuration for the current project. Detects OpenCode and/or Claude Code automatically.
161
+ ```bash
162
+ # Auto-detect and install to project
163
+ /ciel-init
10
164
 
11
- Usage: `/ciel-init`
165
+ # Force Claude Code, user scope
166
+ /ciel-init --platform=claude --user
12
167
 
13
- ## What it does
168
+ # Check what would change (dry-run)
169
+ /ciel-init --check
14
170
 
15
- - Detects platform (OpenCode / Claude Code / both)
16
- - Copies agent definitions (`.opencode/agents/`)
17
- - Copies commands (`.opencode/commands/`)
18
- - Patches `opencode.json` with plugin reference
19
- - Creates `.ciel/` state directory
171
+ # Force OpenCode
172
+ /ciel-init --platform=opencode
173
+ ```
@@ -0,0 +1,40 @@
1
+ ---
2
+ description: ---
3
+ subtask: false
4
+ ---
5
+
6
+ ---
7
+ description: Migrates Ciel configuration between versions — updates CLAUDE.md format, skill references, hook wiring, and platform-specific configs. Supports v5→v6 migration (pipeline change, skill taxonomy reorganization). Non-destructive: backs up before any write.
8
+ ---
9
+
10
+ # /ciel-migrate — Migrate Ciel Between Versions
11
+
12
+ *Migrates project config from one Ciel version to another.*
13
+
14
+ Usage: `/ciel-migrate [--dry-run] [--from=<version>] [--to=<version>]`
15
+
16
+ - `--dry-run` — show what would change without writing
17
+ - `--from=v5` — source version (auto-detected if absent)
18
+ - `--to=v6` — target version (default: latest)
19
+
20
+ ## Supported migrations
21
+
22
+ | From | To | Changes |
23
+ |------|----|---------|
24
+ | v5 | v6 | Update CLAUDE.md format (pipeline steps + depth gauge), update skill catalog in ciel/reference.md, rewire hooks if settings.json references old paths, update platform deploy templates |
25
+
26
+ ## Migration process
27
+
28
+ 1. Read current version from `.ciel/memory.json` `cielVersion` field
29
+ 2. Detect source version from config patterns
30
+ 3. Back up all files that will be modified (`.bak-<timestamp>`)
31
+ 4. Apply version-specific transformations
32
+ 5. Write new `.ciel/memory.json` with updated version
33
+ 6. Report summary of changes
34
+
35
+ ## Guardrails
36
+
37
+ - **Always backs up before writing** — restore with `mv .bak-<timestamp>/* .`
38
+ - **`--dry-run` is safe** — no files are touched
39
+ - **Unknown version → abort** — don't guess the migration path
40
+ - **One version hop at a time** — v5→v6, not v4→v6 directly
@@ -1,20 +1,96 @@
1
1
  ---
2
- command: ciel-refresh
3
- description: Freshness audit over the skill library
4
- agent: ciel-improver
5
- subtask: true
2
+ description: ---
3
+ subtask: false
6
4
  ---
7
5
 
8
- # /ciel-refresh — Freshness audit
6
+ ---
7
+ description: Scans every Ciel skill for stale external references (outdated library version pins, dead URLs, superseded research citations) and produces a freshness patch-set for user approval. Complements `/ciel-improve` (transcript-driven) by catching drift from the outside world.
8
+ ---
9
+
10
+ # /ciel-refresh — Freshness audit over the skill library
11
+
12
+ *Runs the `skill-freshness-auditor` meta-skill to surface stale external references across every Ciel skill and propose concrete updates.*
13
+
14
+ Usage: `/ciel-refresh [scope] [--force]`
15
+
16
+ - `scope` defaults to `all`. Other scopes: `workflow`, `research`, `domain`, `utility`, `meta`, `ciel`, or a specific skill name like `skill=debug-reasoning-rca`.
17
+ - `--force` bypasses the 18-month URL cache (re-checks every reference even if it was checked recently).
18
+
19
+ ---
20
+
21
+ ## What it does
22
+
23
+ 1. Enumerates every `SKILL.md` and `reference.md` under `$CIEL_DIR/skills/` (or the filtered scope).
24
+ 2. Extracts three categories of external refs:
25
+ - **URLs** (any `http(s)://...`)
26
+ - **Library + version pins** (e.g., `Playwright 1.49`, `React 19`, `Ktor 3.1`)
27
+ - **Research citations** (e.g., `STRATUS 2024`, `ThoughtWorks Tech Radar April 2026`, `OWASP Top 10`, `WCAG 2.2`)
28
+ 3. For each ref, runs a freshness check:
29
+ - URL → `WebFetch` to confirm 200 OK + Last-Modified within the window
30
+ - Library → `WebSearch` for latest stable, compare to the pinned version
31
+ - Citation → `WebSearch` for a named superseding work
32
+ 4. Produces a `freshness patch-set` — one entry per stale ref, with severity HIGH/MEDIUM/LOW and a proposed rewrite.
33
+ 5. Waits for user approval on each patch (`[y/n/edit]`), then applies only the approved ones.
34
+ 6. Logs the audit to `$CIEL_DIR/.freshness-log.jsonl` so future runs can skip refs that were checked recently.
35
+
36
+ ---
37
+
38
+ ## Severity levels
39
+
40
+ | Severity | Trigger | Example |
41
+ |---|---|---|
42
+ | **HIGH** | Broken (404 URL, removed-from-npm library) | `https://defunct-docs.example.com/api` returns 404 |
43
+ | **MEDIUM** | Outdated (lib 1 major behind, URL redirecting away) | Skill pins `Playwright 1.49`, latest is `2.3` |
44
+ | **LOW** | Minor drift (minor-version gap, citation 2-3 years old) | Skill cites `OWASP Top 10 2021`, current is `2025` |
45
+
46
+ ---
9
47
 
10
- Scans every Ciel skill for stale external references (outdated library version pins, dead URLs, superseded research citations) and produces a freshness patch-set for user approval.
48
+ ## Output example
11
49
 
12
- Usage: `/ciel-refresh`
50
+ ```
51
+ # Ciel freshness audit — 2026-04-17T14:30Z
52
+
53
+ Skills scanned: 48
54
+ References extracted: 127 (URLs: 62, libs: 44, citations: 21)
55
+ Cache hits (recent): 41
56
+ Network checks performed: 86
57
+ Findings: HIGH 2, MEDIUM 5, LOW 3
58
+
59
+ ## Patch 1 — skills/workflow/playwright-visual-critic/SKILL.md — FRESHNESS-lib
60
+ Reference: `Playwright 1.49` at line 28
61
+ Finding: Latest stable is Playwright 2.3.1 (released 2026-02) — 2 majors behind.
62
+ Severity: MEDIUM
63
+
64
+ --- BEFORE (line 28)
65
+ Uses Playwright 1.49 MCP server for browser automation.
66
+ --- AFTER (proposed)
67
+ Uses Playwright 2.3.1 MCP server for browser automation (breaking changes vs 1.x: see https://playwright.dev/docs/release-notes#2.0).
68
+
69
+ Approve? [y/n/edit]
70
+ ```
71
+
72
+ ---
73
+
74
+ ## When to run
75
+
76
+ - **Monthly routine** — drift accumulates silently; a batched pass keeps it bounded.
77
+ - **Before a major version bump** — so the new release ships without stale pins.
78
+ - **After a major upstream release** (Claude Code, OpenCode, Anthropic API) — their docs URLs may have moved.
79
+ - **After a long quiet period** on a specific skill — add `scope=skill=<name>` to hit just that one.
80
+
81
+ Avoid running on every task — a full scan burns ~1-3K tokens per skill (WebFetch + WebSearch).
82
+
83
+ ---
84
+
85
+ ## Cost
86
+
87
+ Typical full run (~50 skills) consumes 100-300K tokens depending on how many cached vs new checks. Cheaper after the first run (cache hits dominate). Projected cost is displayed before the network phase — abortable.
88
+
89
+ ---
13
90
 
14
- ## Process
91
+ ## Relation to other `/ciel-*` commands
15
92
 
16
- 1. Lists all skills from `skills/`
17
- 2. For each skill, checks external references
18
- 3. Flags outdated URLs, version pins, citations
19
- 4. Produces patch-set for user approval
20
- 5. Never rewrites autonomously
93
+ - **`/ciel-improve`** transcript-driven; catches what Ciel *experienced*. `/ciel-refresh` catches what *changed outside* Ciel.
94
+ - **`/ciel-eval`** — benchmarks skill variants on fixed datasets. `/ciel-refresh` doesn't grade quality, just currency.
95
+ - **`/ciel-audit`** session-level violations. `/ciel-refresh` is library-level drift.
96
+ - **`/ciel-create-skill`** — scaffolds new. `/ciel-refresh` updates existing.
@@ -0,0 +1,45 @@
1
+ ---
2
+ description: ---
3
+ subtask: false
4
+ ---
5
+
6
+ ---
7
+ description: Displays the current Ciel environment status — active version, loaded skills, registered hooks, last session state, and configuration health. A diagnostic entry point for "is Ciel working?" questions.
8
+ ---
9
+
10
+ # /ciel-status — Ciel Environment Health Check
11
+
12
+ *Displays the current Ciel environment status: version, skills, hooks, and config.*
13
+
14
+ Usage: `/ciel-status [--check]`
15
+
16
+ - `--check` — run diagnostics (verify hooks fire, skills load, config is valid)
17
+
18
+ ## Output
19
+
20
+ ```
21
+ ## CIEL STATUS
22
+
23
+ Version: v6.2.4
24
+ Platform: Claude Code
25
+ Config: .claude/settings.json — OK (4 hooks registered)
26
+ Skills directory: skills/ — 43 skills loaded
27
+ Commands: 7 commands available
28
+ Last session: 2026-05-06T11:20:00Z — Skills library reorg
29
+ ```
30
+
31
+ ## Diagnostics (--check)
32
+
33
+ - [ ] CLAUDE.md readable and includes Ciel pipeline
34
+ - [ ] .claude/settings.json valid JSON, hooks registered
35
+ - [ ] .ciel/map.json parseable and up-to-date
36
+ - [ ] .ciel/memory.json parseable
37
+ - [ ] Shell hooks executable (check-test-first, block-destructive, track-file, meta-critiquer)
38
+ - [ ] Skills directory non-empty and accessible
39
+ - [ ] Agent definitions present (.claude/agents/ or .opencode/agents/)
40
+
41
+ ## When triggered
42
+
43
+ - User asks "is Ciel working?" or "check Ciel health"
44
+ - After ciel-init to verify installation
45
+ - Debugging hook failures or missing depth classification
@@ -1,50 +1,63 @@
1
1
  ---
2
- description: Update Ciel to the latest version via NPM. Checks NPM registry, updates global package, force-reinstalls in project.
2
+ description: ---
3
+ subtask: false
4
+ ---
5
+
6
+ ---
7
+ description: Check GitHub for newer Ciel release and re-install. Runs `scripts/install.sh --check-update` then `--update`.
3
8
  ---
4
9
 
5
10
  # /ciel-update — Update Ciel to the latest version
6
11
 
12
+ Checks GitHub for a newer release and re-installs if available.
13
+
7
14
  ## Steps
8
15
 
9
- ### Global install (recommended)
16
+ 1. **Check version**: `bash scripts/install.sh --check-update`
17
+ - Fetches `VERSION` from GitHub, compares with local
18
+ - Prints "up to date" or "update available"
10
19
 
11
- ```bash
12
- # 1. Check
13
- ciel check
20
+ 2. **Apply update**: `bash scripts/install.sh --update -y`
21
+ - Re-installs all Ciel files (plugins, agents, commands, hooks)
22
+ - Preserves: `ciel-overlay.md`, `.ciel/`, existing configs
23
+ - Non-destructive merge on `opencode.json`
14
24
 
15
- # 2. Update global package
16
- npm update -g @neikyun/ciel
25
+ ## Flags
17
26
 
18
- # 3. Force reinstall in project (new plugin JS, agents, commands, hooks)
19
- ciel update
20
- ```
27
+ | Flag | Purpose |
28
+ |------|---------|
29
+ | `--check-update` | Check remote version, don't install |
30
+ | `--update` / `-u` | Force reinstall all files |
31
+ | `-y` | Skip confirmation (non-interactive) |
32
+ | `-q` | Quiet mode (summary only) |
21
33
 
22
- ### Project-local install
34
+ ## One-liner
23
35
 
24
36
  ```bash
25
- npm update @neikyun/ciel # postinstall auto-updates everything
37
+ bash <(curl -fsSL https://raw.githubusercontent.com/KaosKyun/Ciel/main/scripts/install.sh) --check-update
38
+ bash <(curl -fsSL https://raw.githubusercontent.com/KaosKyun/Ciel/main/scripts/install.sh) --update -y
26
39
  ```
27
40
 
28
41
  ## What's preserved
29
42
 
30
43
  - `ciel-overlay.md` — project-specific rules
31
- - `.ciel/map.json`, `.ciel/memory.json`, `.ciel/parking.md` — persistent state
32
- - `opencode.json` — existing config patched non-destructively
44
+ - `.ciel/map.json`, `.ciel/memory.json`, `.ciel/parking.md`
45
+ - `opencode.json` — existing config merged non-destructively
46
+ - `.claude/settings.json` — hook paths preserved
33
47
 
34
48
  ## What's replaced
35
49
 
36
- - `.opencode/plugins/ciel.js` — compiled plugin
50
+ - `.opencode/plugins/ciel.ts` — fresh plugin
37
51
  - `.opencode/agents/ciel-*.md` — agent definitions
38
52
  - `.opencode/commands/ciel-*.md` — command files
39
53
  - `.claude/agents/ciel-*.md` — Claude Code agents
40
54
  - `.claude/hooks/*.sh` — shell hooks
41
55
  - `CLAUDE.md` — root instruction
42
- - `.claude/settings.json` — hook config
43
56
 
44
57
  ## Troubleshooting
45
58
 
46
59
  | Symptom | Fix |
47
60
  |---------|-----|
61
+ | `Could not fetch remote version` | Check internet or proxy: `https_proxy=... bash install.sh --check-update` |
48
62
  | Plugin not loaded after update | Restart OpenCode (plugin loaded at session start) |
49
- | `ciel: command not found` | Reinstall globally: `npm install -g @neikyun/ciel` |
50
- | NPM registry unreachable | Check internet or proxy: `HTTPS_PROXY=... ciel check` |
63
+ | `jq not found` warning | Install jq for automatic opencode.json patching |
@@ -1,6 +1,5 @@
1
1
  ---
2
- command: ciel
3
- description: Ciel orchestrator — full 16-step deep-reasoning pipeline
2
+ description: Slash trigger for the Ciel orchestrator skill on OpenCode.
4
3
  ---
5
4
 
6
5
  Invoke the `ciel` skill via the Skill tool with the user's arguments:
@@ -0,0 +1,146 @@
1
+ // Ciel — OpenCode plugin (v6.2.4)
2
+ // Ciel v5 plugin. Pure TS, no shell dependency.
3
+ //
4
+ // Injection model (verified against @opencode-ai/plugin/dist/index.d.ts):
5
+ // - experimental.chat.system.transform → push depth hint + sticky RELIRE
6
+ // notice into the system-prompt array each turn. Both are visible to
7
+ // the model on the following turn.
8
+ // - tool.execute.after (write|edit) → append a per-file FAIRE/RELIRE
9
+ // reminder to the tool result string so the model reads it on its
10
+ // next turn attached to that tool call.
11
+ // - session.created (event) → console banner only (no
12
+ // model-visible injection needed at session start).
13
+ //
14
+ // Why not tool.execute.before? Its output shape is { args } only — no way
15
+ // to inject context, and console.log goes to terminal/plugin log, not the
16
+ // model.
17
+ //
18
+ // Why not chat.params? Its output has no `system` field; pushing to it
19
+ // is a silent no-op. Depth hints belong in experimental.chat.system.transform.
20
+ //
21
+ // The experimental.* hooks may shift between OpenCode releases. Regenerate
22
+ // this file with `scripts/build-platforms.sh --target=opencode` after any
23
+ // upstream plugin API change.
24
+
25
+ import type { Plugin } from "@opencode-ai/plugin";
26
+
27
+ const CODE_EXT_RE = /\.(kt|java|ts|tsx|js|jsx|py|go|rs|rb|php|cs|cpp|c|swift|scala|vue|svelte|sql)$/i;
28
+ const CRITICAL_FILE_RE = /(auth|Auth|security|Security|Route|Service|Controller|Repository|Gateway|Middleware|Proxy|Token|Session|Password|Secret)/;
29
+ const CRITICAL_KEYWORD_RE = /\b(auth|authenti|author|jwt|oauth|password|secret|token|session|payment|credit.card|migration.*schema|2fa|mfa|encryption|credential|cookie.*security)\b/i;
30
+ const TRIVIAL_KEYWORD_RE = /\b(rename|typo|copyright|comment|readme|1-line|one.line|fix.typo|spelling)\b/i;
31
+
32
+ const ciel: Plugin = async ({ $ }) => {
33
+ // Per-session state. Reset when the plugin module is re-instantiated
34
+ // (once per OpenCode session).
35
+ const writtenFiles = new Set<string>();
36
+ const remindedFiles = new Set<string>();
37
+ let relireSticky = false; // once true, every turn re-injects the RELIRE notice
38
+ let lastDepthHint: string | null = null;
39
+
40
+ // v3.3.0 — dispatch-gate counter removed. The per-call [CIEL COUNTER: N/15]
41
+ // systemMessage was pure noise on every inline tool call. Depth routing
42
+ // still happens via experimental.chat.system.transform + the sticky
43
+ // RELIRE notice; users dispatch @ciel-* explicitly when they need one.
44
+
45
+ return {
46
+ event: async ({ event }) => {
47
+ if (event.type === "session.created") {
48
+ // Terminal-only banner. Model context is handled by the transform hook.
49
+ console.log("[CIEL] Session started — depth-aware reasoning active. Use /ciel, @ciel-researcher, @ciel-explorer, @ciel-critic.");
50
+ }
51
+ },
52
+
53
+ // Per-turn system-prompt injection. This hook runs on every model turn
54
+ // so we get a reliable "inject once per turn" surface without having to
55
+ // manage cross-hook message state ourselves.
56
+ "experimental.chat.system.transform": async (_input, output) => {
57
+ if (lastDepthHint && Array.isArray(output?.system)) {
58
+ output.system.push(lastDepthHint);
59
+ }
60
+ if (relireSticky && Array.isArray(output?.system)) {
61
+ const changed = Array.from(writtenFiles);
62
+ output.system.push(
63
+ `[CIEL RELIRE REQUIRED] ${changed.length} code files changed this session (${changed.slice(0, 6).join(", ")}${changed.length > 6 ? ", ..." : ""}). Dispatch @ciel-critic MODE=RELIRE — 3 RISQUES + FIX/ACCEPT/DEFER. Do not declare done before verdict.`
64
+ );
65
+ }
66
+ },
67
+
68
+ // Full message-list transform — read the most recent user text and
69
+ // reclassify depth every turn. Keeps lastDepthHint fresh; the actual
70
+ // injection happens in the system.transform hook above.
71
+ "experimental.chat.messages.transform": async (_input, output) => {
72
+ const msgs = output?.messages;
73
+ if (!Array.isArray(msgs) || msgs.length === 0) return;
74
+ // Find the most recent user text part.
75
+ let prompt = "";
76
+ for (let i = msgs.length - 1; i >= 0 && !prompt; i--) {
77
+ const m = msgs[i];
78
+ if (m?.info?.role !== "user") continue;
79
+ const parts = m?.parts;
80
+ if (!Array.isArray(parts)) continue;
81
+ for (let j = parts.length - 1; j >= 0; j--) {
82
+ const p = parts[j];
83
+ if (p?.type === "text" && typeof p.text === "string") {
84
+ prompt = p.text;
85
+ break;
86
+ }
87
+ }
88
+ }
89
+ if (!prompt) return;
90
+
91
+ let depth: string | null = null;
92
+ let reason = "";
93
+ if (CRITICAL_KEYWORD_RE.test(prompt)) {
94
+ depth = "Critical";
95
+ reason = "auth/security/payment keyword detected";
96
+ } else if (TRIVIAL_KEYWORD_RE.test(prompt)) {
97
+ depth = "Trivial";
98
+ reason = "rename/typo/docs keyword detected";
99
+ }
100
+ lastDepthHint = depth
101
+ ? `[CIEL] Depth: ${depth} (${reason}). Route the pipeline accordingly.`
102
+ : null;
103
+ },
104
+
105
+ tool: {
106
+ execute: {
107
+ // Append FAIRE/RELIRE reminder to the tool result text. OpenCode's
108
+ // tool.execute.after output is { title, output, metadata } — the
109
+ // `output` field is the tool result string surfaced to the model.
110
+ // Mutation here is the ONLY way to inject per-tool context.
111
+ after: async (input, output) => {
112
+ if (!["write", "edit"].includes(input.tool)) return;
113
+ const args: any = (input as any).args ?? {};
114
+ const filePath: string = args.file_path ?? args.path ?? "";
115
+ if (!filePath || !CODE_EXT_RE.test(filePath)) return;
116
+
117
+ writtenFiles.add(filePath);
118
+
119
+ const isCritical = CRITICAL_FILE_RE.test(filePath);
120
+ if (writtenFiles.size >= 5 || isCritical) {
121
+ relireSticky = true;
122
+ }
123
+
124
+ // Per-file FAIRE reminder fires once per path to avoid burning
125
+ // ~50 tokens × N edits on the same file.
126
+ if (remindedFiles.has(filePath)) return;
127
+ remindedFiles.add(filePath);
128
+
129
+ const reminder = isCritical
130
+ ? `\n\n[CIEL CRITIQUE] ${filePath} — FAIRE gates + stride-analyzer + flux-narrator + test-first (RED). Dispatch @ciel-critic MODE=RELIRE before declaring done.`
131
+ : `\n\n[CIEL] ${filePath} — FAIRE gates: alternatives, idiomatic, test-first. Ensure @ciel-researcher + @ciel-explorer ran.`;
132
+
133
+ if (typeof output?.output === "string") {
134
+ output.output += reminder;
135
+ } else if (output) {
136
+ // Defensive: if output.output is missing/nullish, create it so
137
+ // the reminder still lands on the model.
138
+ (output as any).output = reminder.trimStart();
139
+ }
140
+ },
141
+ },
142
+ },
143
+ };
144
+ };
145
+
146
+ export default ciel;
@@ -1,4 +1,4 @@
1
- # AGENTS.md — Ciel deep-reasoning workflow (OpenCode, v3.3.0)
1
+ # AGENTS.md — Ciel deep-reasoning workflow (OpenCode, v6.2.4)
2
2
 
3
3
  Source: https://github.com/KaosKyun/Ciel
4
4
 
@@ -16,7 +16,7 @@ Ciel is installed as OpenCode-native primitives:
16
16
 
17
17
  | Level | Example | Pipeline |
18
18
  |-------|---------|----------|
19
- | **Trivial** | rename, typo, 1-line fix | `quoi-framer` → `pattern-fitness-check` → `faire-gatekeeper` → inline review → push |
19
+ | **Trivial** | rename, typo, 1-line fix | `QUOI` → `FAIRE` → `META` |
20
20
  | **Standard** | hook, route, component, service | Full pipeline, dispatch `@ciel-researcher` + `@ciel-explorer` in parallel before coding |
21
21
  | **Critical** | auth, DB schema, security, payment | Full pipeline + STRIDE threat model + `@ciel-critic` mandatory |
22
22