@neikyun/ciel 6.14.1 → 6.14.2

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 (101) hide show
  1. package/assets/.claude/hooks/check-dispatch-gate.sh +14 -41
  2. package/assets/.claude/hooks/memory-engine.py +66 -5
  3. package/assets/.claude/hooks/pre-tool-write.sh +17 -52
  4. package/assets/.claude/hooks/session-start.sh +15 -128
  5. package/assets/.claude/hooks/stop.sh +10 -85
  6. package/assets/.claude/hooks/user-prompt-submit.sh +17 -110
  7. package/assets/.claude/rules/api-design.md +23 -0
  8. package/assets/.claude/rules/backend.md +22 -0
  9. package/assets/.claude/rules/cicd-pipeline.md +23 -0
  10. package/assets/.claude/rules/containers.md +23 -0
  11. package/assets/.claude/rules/database-design.md +22 -0
  12. package/assets/.claude/rules/environments.md +27 -0
  13. package/assets/.claude/rules/frontend.md +25 -0
  14. package/assets/.claude/rules/github.md +22 -0
  15. package/assets/.claude/rules/logging.md +23 -0
  16. package/assets/.claude/rules/monitoring.md +25 -0
  17. package/assets/.claude/rules/research.md +20 -0
  18. package/assets/.claude/settings.json +2 -58
  19. package/assets/.claude/skills/agile/SKILL.md +42 -0
  20. package/assets/.claude/skills/alerting/SKILL.md +55 -0
  21. package/assets/.claude/skills/api-design/SKILL.md +46 -0
  22. package/assets/.claude/skills/appsec/SKILL.md +43 -0
  23. package/assets/.claude/skills/architecture/SKILL.md +74 -0
  24. package/assets/.claude/skills/backend/SKILL.md +41 -0
  25. package/assets/.claude/skills/backup-recovery/SKILL.md +42 -0
  26. package/assets/.claude/skills/caching/SKILL.md +44 -0
  27. package/assets/.claude/skills/cdn/SKILL.md +42 -0
  28. package/assets/.claude/skills/chaos/SKILL.md +41 -0
  29. package/assets/.claude/skills/cicd-pipeline/SKILL.md +56 -0
  30. package/assets/.claude/skills/ciel/SKILL.md +14 -0
  31. package/assets/.claude/skills/ciel/reference.md +171 -0
  32. package/assets/.claude/skills/cloud/SKILL.md +42 -0
  33. package/assets/.claude/skills/code-quality/SKILL.md +42 -0
  34. package/assets/.claude/skills/code-review/SKILL.md +41 -0
  35. package/assets/.claude/skills/communication/SKILL.md +42 -0
  36. package/assets/.claude/skills/containers/SKILL.md +42 -0
  37. package/assets/.claude/skills/cqrs/SKILL.md +41 -0
  38. package/assets/.claude/skills/crypto/SKILL.md +46 -0
  39. package/assets/.claude/skills/data-engineering/SKILL.md +42 -0
  40. package/assets/.claude/skills/database-design/SKILL.md +46 -0
  41. package/assets/.claude/skills/ddd/SKILL.md +45 -0
  42. package/assets/.claude/skills/deployment-strategies/SKILL.md +51 -0
  43. package/assets/.claude/skills/desktop/SKILL.md +42 -0
  44. package/assets/.claude/skills/devsecops/SKILL.md +43 -0
  45. package/assets/.claude/skills/environments/SKILL.md +66 -0
  46. package/assets/.claude/skills/event-driven/SKILL.md +46 -0
  47. package/assets/.claude/skills/frontend/SKILL.md +41 -0
  48. package/assets/.claude/skills/functional/SKILL.md +42 -0
  49. package/assets/.claude/skills/github/SKILL.md +61 -0
  50. package/assets/.claude/skills/high-availability/SKILL.md +42 -0
  51. package/assets/.claude/skills/iac/SKILL.md +46 -0
  52. package/assets/.claude/skills/logging/SKILL.md +46 -0
  53. package/assets/.claude/skills/ml-engineering/SKILL.md +42 -0
  54. package/assets/.claude/skills/mobile/SKILL.md +42 -0
  55. package/assets/.claude/skills/monitoring/SKILL.md +54 -0
  56. package/assets/.claude/skills/networking/SKILL.md +42 -0
  57. package/assets/.claude/skills/nosql/SKILL.md +41 -0
  58. package/assets/.claude/skills/oop-solid/SKILL.md +42 -0
  59. package/assets/.claude/skills/performance/SKILL.md +41 -0
  60. package/assets/.claude/skills/reactive/SKILL.md +42 -0
  61. package/assets/.claude/skills/release-management/SKILL.md +51 -0
  62. package/assets/.claude/skills/research/SKILL.md +69 -0
  63. package/assets/.claude/skills/resilience/SKILL.md +41 -0
  64. package/assets/.claude/skills/serverless/SKILL.md +42 -0
  65. package/assets/.claude/skills/servers/SKILL.md +41 -0
  66. package/assets/.claude/skills/sql/SKILL.md +45 -0
  67. package/assets/.claude/skills/supply-chain/SKILL.md +41 -0
  68. package/assets/.claude/skills/system-design/SKILL.md +91 -0
  69. package/assets/.claude/skills/tech-leadership/SKILL.md +46 -0
  70. package/assets/.claude/skills/testing/SKILL.md +41 -0
  71. package/assets/.claude/skills/tracing/SKILL.md +36 -0
  72. package/assets/CLAUDE.md +31 -122
  73. package/assets/commands/{ciel-memory-bootstrap.md → ciel-memory-init.md} +3 -3
  74. package/assets/commands/ciel-memory.md +210 -0
  75. package/assets/platforms/opencode/.opencode/commands/{ciel-memory-bootstrap.md → ciel-memory-init.md} +3 -3
  76. package/assets/skills/ciel/SKILL.md +8 -97
  77. package/bin/ciel.js +1 -1
  78. package/dist/cli/check.d.ts.map +1 -1
  79. package/dist/cli/check.js +3 -5
  80. package/dist/cli/check.js.map +1 -1
  81. package/dist/cli/claude.d.ts.map +1 -1
  82. package/dist/cli/claude.js +42 -4
  83. package/dist/cli/claude.js.map +1 -1
  84. package/dist/cli/doctor.d.ts +16 -0
  85. package/dist/cli/doctor.d.ts.map +1 -0
  86. package/dist/cli/doctor.js +168 -0
  87. package/dist/cli/doctor.js.map +1 -0
  88. package/dist/cli/index.js +10 -0
  89. package/dist/cli/index.js.map +1 -1
  90. package/dist/cli/init.d.ts.map +1 -1
  91. package/dist/cli/init.js +23 -4
  92. package/dist/cli/init.js.map +1 -1
  93. package/dist/cli/memory.d.ts +18 -0
  94. package/dist/cli/memory.d.ts.map +1 -0
  95. package/dist/cli/memory.js +304 -0
  96. package/dist/cli/memory.js.map +1 -0
  97. package/dist/cli/opencode.js +1 -1
  98. package/dist/cli/opencode.js.map +1 -1
  99. package/package.json +2 -2
  100. /package/assets/{rules → .claude/rules}/security.md +0 -0
  101. /package/assets/{rules → .claude/rules}/testing.md +0 -0
@@ -1,17 +1,7 @@
1
1
  #!/bin/bash
2
- # Ciel — Stop hook
3
- # Trigger: Claude finishes responding (end of task)
4
- # Purpose: (1) inject meta-critiquer instruction; (2) if on default branch with
5
- # 3+ unreleased feat/fix commits, prepend a release-gate reminder.
6
- #
7
- # Claude Code Stop-hook schema rejects hookSpecificOutput.additionalContext
8
- # (it is only valid for UserPromptSubmit/PostToolUse). The documented way to
9
- # steer the model at Stop is {"decision":"block","reason":"..."} — the reason
10
- # is surfaced as an instruction the model must address.
11
- #
12
- # Both meta-critiquer and release-gate are combined into a single `reason`
13
- # field so only one block event fires per Stop. The existing stop_hook_active
14
- # loop guard handles re-entry for both.
2
+ # Ciel v9 — Stop hook
3
+ # Injects 3 META reflection questions via decision:block.
4
+ # Never blocks more than once per session.
15
5
 
16
6
  INPUT=$(cat 2>/dev/null || echo "{}")
17
7
 
@@ -20,85 +10,20 @@ import sys, json
20
10
  try:
21
11
  d = json.loads(sys.argv[1])
22
12
  print('true' if d.get('stop_hook_active', False) else 'false')
23
- except Exception:
13
+ except:
24
14
  print('false')
25
15
  " "$INPUT" 2>/dev/null || echo "false")
26
16
 
27
- if [ "$ACTIVE" = "true" ]; then
28
- exit 0
29
- fi
17
+ [ "$ACTIVE" = "true" ] && exit 0
30
18
 
31
- # Fail-safe: block at most once per 60s window even if stop_hook_active
32
- # is not set (older Claude Code versions, parsing edge cases, plugin
33
- # auto-discovery re-invoking the same hook from multiple registrations).
34
- # Without this, the same Stop event can fire 9 times → CC overrides the
35
- # hook and emits the "blocked turn 9 times" warning.
36
- PROJECT_KEY=$(echo "${CLAUDE_PROJECT_DIR:-$PWD}" | (shasum 2>/dev/null || sha1sum 2>/dev/null || md5sum 2>/dev/null || md5 -q 2>/dev/null || cksum 2>/dev/null) | cut -c1-12)
37
- LAST_BLOCK_FILE="${TMPDIR:-/tmp}/ciel-stop-last-block-${PROJECT_KEY}"
38
- NOW=$(date +%s)
39
- LAST=$(cat "$LAST_BLOCK_FILE" 2>/dev/null || echo 0)
40
- if [ $((NOW - LAST)) -lt 60 ]; then
41
- exit 0
42
- fi
43
- echo "$NOW" > "$LAST_BLOCK_FILE" 2>/dev/null || true
44
-
45
- CWD=$(python3 -c "
46
- import sys, json
47
- try:
48
- d = json.loads(sys.argv[1])
49
- print(d.get('cwd', ''))
50
- except Exception:
51
- print('')
52
- " "$INPUT" 2>/dev/null || echo "")
53
-
54
- # Release-gate check — writes RG_MSG if it should fire
55
- RG_MSG=""
56
- check_release_gate() {
57
- local cwd="$1"
58
- [ -z "$cwd" ] && return 1
59
- command -v git >/dev/null 2>&1 || return 1
60
- git -C "$cwd" rev-parse --git-dir >/dev/null 2>&1 || return 1
61
-
62
- local current default
63
- current=$(git -C "$cwd" rev-parse --abbrev-ref HEAD 2>/dev/null)
64
- default=$(git -C "$cwd" symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
65
- [ -z "$default" ] && default="main"
66
- [ "$current" = "$default" ] || return 1
67
-
68
- local snooze="$cwd/.ciel-release-snooze"
69
- if [ -f "$snooze" ] && find "$snooze" -mmin -60 2>/dev/null | grep -q .; then
70
- return 1
71
- fi
72
-
73
- local last_tag range pending
74
- last_tag=$(git -C "$cwd" describe --tags --abbrev=0 2>/dev/null || echo "")
75
- if [ -z "$last_tag" ]; then
76
- range="HEAD"
77
- else
78
- range="$last_tag..HEAD"
79
- fi
80
- pending=$(git -C "$cwd" log "$range" --oneline 2>/dev/null | grep -cE '^[a-f0-9]+ (feat|fix)(\(|:|!)' || echo 0)
81
-
82
- [ "$pending" -ge 3 ] || return 1
83
-
84
- local tag_label="${last_tag:-<no previous tag>}"
85
- RG_MSG="CIEL RELEASE-GATE — $pending feat/fix commit(s) on $default since $tag_label without a release. Actions: (1) bump VERSION per conventional-commit scope (feat=minor, fix=patch, feat!/fix!=major), (2) append CHANGELOG.md entry, (3) git tag -a v<N.N.N>, (4) gh release create v<N.N.N> --generate-notes. Invoke changelog-updater + release-publisher skills. Snooze 60min: touch .ciel-release-snooze."
86
- return 0
87
- }
88
-
89
- META_MSG="CIEL STOP — 30s META-CRITIQUER obligatoire avant de declarer fini: (1) depth match? (2) new failure mode → Guard? (3) user correction → memoire (capture to .ciel/memory/episodes/ via memory-engine.py)? (4) stale branches? (5) uncovered issues? (6) context health? (7) session-progress.md written? (8) dead code sweep (ruff/knip/Detekt)? (9) agent-discovered pattern → memoire capture (if you noticed a reusable pattern, bug, or convention not yet in .ciel/memory/ — call memory-engine.py capture with --captured-from=agent-observed)? (10) 5+ triggers without promotion → invoke memoire-consolidator? Invoke meta-critiquer skill then memoire."
90
-
91
- if check_release_gate "$CWD"; then
92
- MSG="$RG_MSG
93
-
94
- $META_MSG"
95
- else
96
- MSG="$META_MSG"
97
- fi
19
+ META_MSG="CIEL 30s META reflection avant de declarer fini:
20
+ 1. Qu'ai-je manque que l'utilisateur va me demander ensuite ?
21
+ 2. Quelle decision ou decouverte merite d'etre sauvegardee en memoire ?
22
+ 3. Si je devais refaire cette tache, que ferais-je differemment ?"
98
23
 
99
24
  python3 -c "
100
25
  import json, sys
101
26
  print(json.dumps({'decision': 'block', 'reason': sys.argv[1]}))
102
- " "$MSG"
27
+ " "$META_MSG"
103
28
 
104
29
  exit 0
@@ -1,8 +1,6 @@
1
1
  #!/bin/bash
2
- # Ciel — UserPromptSubmit hook
3
- # Trigger: user submits a prompt (before Claude processes)
4
- # Purpose: light depth pre-classification hint injected into context
5
- # Invokes: depth-classifier skill (lightweight mode)
2
+ # Ciel v9 — UserPromptSubmit hook
3
+ # Injects: depth hint + cued-recall memory + intervention detection
6
4
  # Never blocks (exit 0 always)
7
5
 
8
6
  INPUT=$(cat 2>/dev/null || echo "{}")
@@ -17,85 +15,19 @@ except:
17
15
 
18
16
  [ -z "$PROMPT" ] && exit 0
19
17
 
20
- # Depth classification is model-driven, not regex-driven.
21
- # Default to Standard — the model reclassifies via depth-classifier skill at DOCS step
22
- # and writes the result to .ciel/last-depth (read by pre-tool-write gate).
23
- # No mechanical keyword detection — regex is too imprecise for AI-driven tasks.
18
+ # Depth classification default Standard, model reclassifies at DOCS
24
19
  DEPTH="Standard"
25
- REASON="model reclassifies via depth-classifier at DOCS — write to .ciel/last-depth"
26
20
 
27
- DISPATCH_GATE=""
28
- if [[ "$DEPTH" == "Standard" || "$DEPTH" == "Critical" ]]; then
29
- DISPATCH_GATE=" | DISPATCH GATE: dispatch ciel-researcher + ciel-explorer in parallel BEFORE first Bash/Read/Edit."
30
- fi
31
-
32
- META_GATE=""
33
- PROJECT_DIR="${CLAUDE_PROJECT_DIR:-}"
34
- if [ -n "$PROJECT_DIR" ] && [ -f "$PROJECT_DIR/.ciel/tracked-files.json" ]; then
35
- EDIT_COUNT=$(CIEL_PATH="$PROJECT_DIR/.ciel/tracked-files.json" python3 -c "
36
- import json, os
37
- try: print(len(json.load(open(os.environ['CIEL_PATH']))))
38
- except: print(0)
39
- " 2>/dev/null || echo "0")
40
- if [ "${EDIT_COUNT:-0}" -ge 3 ] 2>/dev/null; then
41
- # Write META-pending flag — persists across sessions until META completed
42
- META_FLAG="$PROJECT_DIR/.ciel/meta-pending"
43
- mkdir -p "$PROJECT_DIR/.ciel" 2>/dev/null || true
44
- python3 -c "
45
- import json, os, datetime
46
- flag = os.environ.get('META_FLAG', '')
47
- if flag:
48
- data = {'edits': int(os.environ.get('EDIT_COUNT', '0')), 'since': datetime.datetime.utcnow().isoformat() + 'Z'}
49
- with open(flag, 'w') as f:
50
- json.dump(data, f)
51
- " META_FLAG="$META_FLAG" EDIT_COUNT="$EDIT_COUNT" 2>/dev/null || true
52
- META_GATE=" | META GATE: ${EDIT_COUNT} files edited — previous task MUST complete 10-item META reflection via Skill(meta-critiquer) BEFORE next task. META is NOT optional after 3+ edits. Clear .ciel/meta-pending when done."
53
- elif [ "${EDIT_COUNT:-0}" -gt 0 ] 2>/dev/null; then
54
- META_GATE=" | META GATE: ${EDIT_COUNT} file(s) edited — complete 10-item META if previous task ended at PROUVER."
55
- fi
56
- fi
57
-
58
- # ─── Cued-recall: intervention + explicit-save detection ─────────────────────
59
- # Two narrow buckets, BOTH high-precision (POSIX-ERE, no PCRE lookahead):
60
- # 1. Intervention regex — user corrections ("you forgot", "non en fait", …)
61
- # 2. Explicit save-request regex — direct capture asks ("save this to memory", …)
62
- # Bare verbs without an explicit memory noun (e.g. "remember to commit",
63
- # "memorise this") are deliberately NOT triggers — an earlier draft used
64
- # `remember (this|that|it|to)` and fired on every casual "I'll remember to X"
65
- # prompt, polluting the cued-recall corpus. Each save-request branch REQUIRES
66
- # the noun `memory`/`mémoire` OR the unambiguous verb+object pair
67
- # `mémorise <ça/cela/ceci>` / `memorise <this/that/it>`. Anchored to sentence
68
- # boundary so trailing "remember" never fires. See ADR-0001, skill `memoire`,
69
- # and packages/ciel/test/hooks-regex.test.ts.
70
- INTERVENTION_GATE=""
71
- # Bucket 1: corrections / "you missed something" (unchanged from v6.2 — proven precise)
72
- if echo "$PROMPT" | grep -qiE "(tu as oublié|t'as oublié|n'oublie pas (que|de)|non en fait|non,? en fait|attention que|rappelle-toi (que|de)|ici on (fait|utilise) plutôt|non on (fait|utilise) plutôt|en fait c'est pas|c'est pas comme ça|mauvaise approche|tu te trompes|you forgot (to|that)|don't forget (to|that)|that's not (right|correct|how)|that's wrong|no[,]? actually|actually,? no|wait[,—-] (no|don't|you forgot)|stop[,—-] (no|you forgot|don't))"; then
73
- INTERVENTION_GATE=" | CAPTURE GATE: intervention pattern detected — propose AskUserQuestion to capture as memory under .ciel/memory/episodes/ (skill: memoire). Never silent-write."
74
- fi
75
- # Bucket 2: explicit save requests — every branch requires the memory noun or
76
- # unambiguous mémorise/memorise+object. Anchored to start-of-prompt or
77
- # sentence boundary so "I'll remember the memory of …" never fires.
78
- if [ -z "$INTERVENTION_GATE" ] && echo "$PROMPT" | grep -qiE "(^|[[:space:].!?])(save (this|that|it) (to|in|into) (the )?memory|put (this|that|it) (in|into) (the )?memory|put (it|this|that) in (the )?memory of ciel|garde (ça|cela|ceci) en (mémoire|memoire)|mets (ça|cela|ceci) en (mémoire|memoire)|enregistre (ça|cela|ceci) (en|dans la|à la) (mémoire|memoire)|sauvegarde (ça|cela|ceci) (en|dans la|à la) (mémoire|memoire)|mémorise (ça|cela|ceci)|memorise (this|that|it))"; then
79
- INTERVENTION_GATE=" | CAPTURE GATE: explicit save request detected — propose AskUserQuestion then capture as memory under .ciel/memory/episodes/ via memory-engine.py (skill: memoire). NEVER write to Claude Code auto-memory (~/.claude/projects/<slug>/memory/MEMORY.md) — that is a DIFFERENT system and invisible to /ciel-audit. Never silent-write."
80
- fi
81
-
82
- # ─── Cued-recall: query memory engine for matching memories ──────────────────
83
- # Calls hooks/memory-engine.py if installed and a memory corpus exists. The
84
- # engine handles cue extraction (paths, symbols, intents, language), scoring,
85
- # token cap, decay, and trigger updates. See docs/adrs/0001-cued-recall-memory.md.
21
+ # ─── Cued-recall: query memory engine ──────────────────────────────────
86
22
  MEMORY_OUTPUT=""
87
23
  ENGINE_PATH=""
88
- # Resolution order: same dir as this script (most reliable, found via BASH_SOURCE)
89
- # → project-relative paths in priority order → $HOME fallbacks. Covers local-mode
90
- # install (top-level hooks/), curl-mode install (.claude/hooks/ or ~/.claude/plugins/ciel/),
91
- # and OpenCode plugin layout (~/.config/opencode/...).
92
24
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd 2>/dev/null || echo "")"
25
+ PROJECT_DIR="${CLAUDE_PROJECT_DIR:-}"
26
+
93
27
  for candidate in \
94
28
  "$SCRIPT_DIR/memory-engine.py" \
95
29
  "$PROJECT_DIR/.claude/hooks/memory-engine.py" \
96
- "$PROJECT_DIR/hooks/memory-engine.py" \
97
- "$HOME/.claude/plugins/ciel/memory-engine.py" \
98
- "$HOME/.ciel/hooks/memory-engine.py"; do
30
+ "$PROJECT_DIR/hooks/memory-engine.py"; do
99
31
  if [[ -n "$candidate" ]] && [[ -f "$candidate" ]]; then
100
32
  ENGINE_PATH="$candidate"
101
33
  break
@@ -107,46 +39,21 @@ if [[ -n "$ENGINE_PATH" ]] && [[ -n "$PROJECT_DIR" ]] && [[ -f "$PROJECT_DIR/.ci
107
39
  MEMORY_OUTPUT=$(python3 "$ENGINE_PATH" query --prompt "$PROMPT" --cwd "$PROJECT_DIR" --depth "$DEPTH_LOWER" 2>/dev/null || echo "")
108
40
  fi
109
41
 
110
- # Persist depth classification for downstream hooks (pre-tool-write gate reads this)
111
- if [ -n "${CLAUDE_PROJECT_DIR:-}" ]; then
112
- echo "$DEPTH" > "$CLAUDE_PROJECT_DIR/.ciel/last-depth" 2>/dev/null || true
42
+ # ─── Intervention detection ─────────────────────────────────────────────
43
+ INTERVENTION_GATE=""
44
+ if echo "$PROMPT" | grep -qiE "(tu as oublié|t'as oublié|non en fait|attention que|ici on (fait|utilise) plutôt|tu te trompes|you forgot (to|that)|don't forget|that's not (right|correct|how)|no[,]? actually|wait[,—-] (no|don't|you forgot)|mauvaise approche)"; then
45
+ INTERVENTION_GATE=" | CAPTURE GATE: intervention detected — propose memory capture via memoire skill"
113
46
  fi
114
47
 
115
- # ─── Pipeline state tracker ───────────────────────────────────────────
116
- PIPELINE_STATE=""
117
- if [ -n "$PROJECT_DIR" ] && [ -f "$PROJECT_DIR/.ciel/pipeline-state.json" ]; then
118
- PIPELINE_STATE=$(STATE_FILE="$PROJECT_DIR/.ciel/pipeline-state.json" python3 << 'PYEOF'
119
- import json, os, sys
120
- try:
121
- with open(os.environ['STATE_FILE']) as f:
122
- state = json.load(f)
123
- steps = state.get('steps', {})
124
- # ASK2 excluded — no Skill/Agent mapping exists for user-validation steps
125
- order = ['DOCS','QUOI','ASK','AVEC QUOI','DIVERGE','RECHERCHE','SECURITE','CODEBASE','EVALUER','FAIRE','TESTER','ADR','RELIRE','PROUVER','MEMOIRE','COMPILER','META']
126
- done = [s for s in order if s in steps and steps[s].get('status') == 'done']
127
- done_count = len(done)
128
- total = len(order)
129
- # Compute pending step: first unfinished after last done
130
- done_indices = [order.index(s) for s in done]
131
- last_done_idx = max(done_indices) if done_indices else -1
132
- pending = order[last_done_idx + 1] if last_done_idx + 1 < total else None
133
- # Show last 6 completed + pending indicator
134
- display = done[-6:] if len(done) > 6 else done[:]
135
- show = [d + '✓' for d in display]
136
- if pending and pending not in done:
137
- show.append(pending + '●')
138
- bar = ' → '.join(show)
139
- print(f' | PIPELINE: {bar} ({done_count}/{total})')
140
- except Exception:
141
- pass
142
- PYEOF
143
- )
48
+ # ─── Persist depth ──────────────────────────────────────────────────────
49
+ if [ -n "${CLAUDE_PROJECT_DIR:-}" ]; then
50
+ echo "$DEPTH" > "$CLAUDE_PROJECT_DIR/.ciel/last-depth" 2>/dev/null || true
144
51
  fi
145
52
 
146
- MSG_BASE="CIEL depth hint: $DEPTH ($REASON).$DISPATCH_GATE$META_GATE$INTERVENTION_GATE$PIPELINE_STATE | SKILLS: load workflow skill via Skill() for current pipeline step (CLAUDE.md column 'Skill a charger'). Never skip. Invoke depth-classifier if ambiguous before routing pipeline."
53
+ # ─── Build context injection ────────────────────────────────────────────
54
+ MSG="CIEL depth: $DEPTH. | Dispatch researcher+explorer before writing code.$INTERVENTION_GATE | Load domain skills via paths: matching files."
147
55
 
148
- # Emit JSON via python to handle newlines and quoting safely
149
- MSG_BASE="$MSG_BASE" MEMORY_OUTPUT="$MEMORY_OUTPUT" python3 -c "
56
+ MSG_BASE="$MSG" MEMORY_OUTPUT="$MEMORY_OUTPUT" python3 -c "
150
57
  import os, json
151
58
  base = os.environ.get('MSG_BASE', '')
152
59
  mem = os.environ.get('MEMORY_OUTPUT', '').strip()
@@ -0,0 +1,23 @@
1
+ ---
2
+ paths:
3
+ - "**/routes/**"
4
+ - "**/*Routes*"
5
+ - "**/*Controller*"
6
+ - "**/*Handler*"
7
+ - "**/openapi*"
8
+ - "**/swagger*"
9
+ ---
10
+
11
+ ## Dispatch
12
+ - Charge `api-design` AVANT d'ecrire ou modifier un endpoint.
13
+ - Si l'endpoint gere des donnees utilisateur → charge aussi `appsec`.
14
+
15
+ ## Regles dures (zero tolerance)
16
+ - **Jamais** de breaking change sans nouvelle version ou deprecation window explicite.
17
+ - **Jamais** de `200 OK` avec erreur dans le corps. Codes HTTP standard.
18
+ - **Jamais** de pagination offset-based. Cursor-based uniquement.
19
+
20
+ ## Conventions du projet
21
+ - Erreurs structurees : `{error: {code, message, details}}`.
22
+ - Mutations POST/PUT/DELETE avec `Idempotency-Key`.
23
+ - Rate limiting avec headers standards : `Retry-After`, `X-RateLimit-*`.
@@ -0,0 +1,22 @@
1
+ ---
2
+ paths:
3
+ - "**/services/**"
4
+ - "**/*Service*"
5
+ - "**/*Server*"
6
+ - "**/server*"
7
+ ---
8
+
9
+ ## Dispatch
10
+ - Charge `backend` AVANT d'ecrire du code backend.
11
+ - Si le service appelle une DB → charge aussi `database-design`.
12
+ - Si le service gere des donnees utilisateur → charge aussi `appsec`.
13
+
14
+ ## Regles dures (zero tolerance)
15
+ - **Jamais** avaler les erreurs. Soit gerer (retry, fallback), soit laisser remonter.
16
+ - **Jamais** de `process.exit(0)` sur SIGTERM. Graceful shutdown : stop accepter → drainer → close → exit.
17
+ - **Jamais** de connexion unique DB/Redis. Connection pooling obligatoire.
18
+
19
+ ## Conventions du projet
20
+ - Chaque endpoint a un timeout explicite.
21
+ - Health check : liveness ≠ readiness.
22
+ - Erreurs structurees en prod, jamais de stack trace.
@@ -0,0 +1,23 @@
1
+ ---
2
+ paths:
3
+ - "**/.github/workflows/**"
4
+ - "**/.gitlab-ci*"
5
+ - "**/Jenkinsfile*"
6
+ - "**/ci*"
7
+ - "**/.circleci/**"
8
+ - "**/azure-pipelines*"
9
+ ---
10
+
11
+ ## Dispatch
12
+ - Charge `cicd-pipeline` AVANT de modifier un pipeline CI/CD.
13
+ - Si le pipeline deploye → charge aussi `release-management`.
14
+
15
+ ## Regles dures (zero tolerance)
16
+ - **Jamais** de secret dans le pipeline. OIDC ou secrets manager.
17
+ - **Jamais** de `on: push` sans filtrage de branche sur les jobs de deploy.
18
+ - **Jamais** de `--no-verify` ou `--no-gpg-sign` dans un pipeline.
19
+
20
+ ## Conventions du projet
21
+ - Feedback < 5 min pour les tests unitaires, < 15 min pour l'integration.
22
+ - Matrix builds pour tester plusieurs versions.
23
+ - Runners ephemeres — pas d'etat persistant entre les jobs.
@@ -0,0 +1,23 @@
1
+ ---
2
+ paths:
3
+ - "**/Dockerfile*"
4
+ - "**/docker-compose*"
5
+ - "**/.dockerignore"
6
+ - "**/*.containerfile"
7
+ - "**/compose*.yml"
8
+ - "**/compose*.yaml"
9
+ ---
10
+
11
+ ## Dispatch
12
+ - Charge `containers` AVANT de modifier des conteneurs.
13
+ - Si le Dockerfile est pour la prod → charge aussi `appsec` + `supply-chain`.
14
+
15
+ ## Regles dures (zero tolerance)
16
+ - **Jamais** de `:latest` en prod. Tag explicite ou digest SHA256.
17
+ - **Jamais** de root dans le container. USER non-root.
18
+ - **Jamais** de secret dans une couche Docker (COPY + RUN + rm = toujours dans l'historique).
19
+
20
+ ## Conventions du projet
21
+ - Multi-stage builds pour separer build et runtime.
22
+ - Layer ordering : dependances (peu changeant) → code source (changeant).
23
+ - Healthcheck dans chaque container de service.
@@ -0,0 +1,22 @@
1
+ ---
2
+ paths:
3
+ - "**/*.sql"
4
+ - "**/migrations/**"
5
+ - "**/schema/**"
6
+ - "**/*Repository*"
7
+ - "**/*Database*"
8
+ ---
9
+
10
+ ## Dispatch
11
+ - Charge `database-design` AVANT d'ecrire du SQL ou de modifier un schema.
12
+ - Si la migration touche une table > 1M rows → charge aussi `resilience`.
13
+
14
+ ## Regles dures (zero tolerance)
15
+ - **Jamais** de `ALTER TABLE` direct sur une grosse table en une etape. Expand/Contract : add column → backfill → add constraint.
16
+ - **Jamais** de FK sans index. Verifiable automatiquement.
17
+ - **Jamais** de logique metier dans la DB (triggers, stored procedures).
18
+
19
+ ## Conventions du projet
20
+ - UUID v7 si distribue, bigint si centralise.
21
+ - Migrations reversibles (up + down) testees en rollback dans la CI.
22
+ - Colonnes NOT NULL par defaut — nullable est l'exception, justifiee.
@@ -0,0 +1,27 @@
1
+ ---
2
+ paths:
3
+ - ".github/workflows/**"
4
+ - ".github/environments/**"
5
+ - "**/environment*"
6
+ - "**/deploy*"
7
+ - "**/ci*.yml"
8
+ - "**/ci*.yaml"
9
+ - "**/.env*"
10
+ - ".env.example"
11
+ ---
12
+
13
+ ## Dispatch
14
+ - Charge `environments` AVANT de modifier la configuration de deploiement, les workflows de deploy, ou les variables d'environnement.
15
+ - Si la tache touche aux secrets → charge aussi `security` et `appsec`.
16
+ - Si la tache touche au pipeline CI/CD → charge aussi `cicd-pipeline`.
17
+
18
+ ## Regles dures (zero tolerance)
19
+ - **Jamais** de secret partage entre environnements. Chaque environnement a ses propres credentials.
20
+ - **Jamais** de deploy direct en production sans gate humaine. Staging d'abord, validation, puis production.
21
+ - **Jamais** de promotion inversee (prod → staging). Le flux est toujours dev → staging → prod.
22
+
23
+ ## Conventions du projet
24
+ - Au moins 2 environnements : staging/preview + production.
25
+ - GitHub Environments pour les secrets par environnement (fonctionne sans organisation).
26
+ - Staging est le jumeau de production — meme stack, meme config, donnees et echelle differentes.
27
+ - Logs et metriques centralises avec tag `env:` (staging/production).
@@ -0,0 +1,25 @@
1
+ ---
2
+ paths:
3
+ - "**/*.tsx"
4
+ - "**/*.jsx"
5
+ - "**/*.vue"
6
+ - "**/*.svelte"
7
+ - "**/*.css"
8
+ - "**/*.scss"
9
+ - "**/components/**"
10
+ - "**/pages/**"
11
+ ---
12
+
13
+ ## Dispatch
14
+ - Charge `frontend` AVANT d'ecrire du code frontend.
15
+ - Si le composant gere l'auth → charge aussi `appsec`.
16
+
17
+ ## Regles dures (zero tolerance)
18
+ - **Jamais** de state management disproportionne : useState → Context → Zustand → Redux (pas l'inverse).
19
+ - **Jamais** de `useEffect` en cascade. Deriver pendant le rendu.
20
+ - **Jamais** de bundle > 200KB sans code splitting par route.
21
+
22
+ ## Conventions du projet
23
+ - Lighthouse ≥ 90 sur perf + a11y + best practices — mesure dans la CI.
24
+ - Accessibilite de base non-negociable : labels, keyboard nav, contrast, ARIA.
25
+ - Formulaires : idle, loading, success, error, validation — tous les etats geres.
@@ -0,0 +1,22 @@
1
+ ---
2
+ paths:
3
+ - ".github/**"
4
+ - ".github/ISSUE_TEMPLATE/**"
5
+ - ".github/workflows/**"
6
+ - "**/pull_request_template.md"
7
+ ---
8
+
9
+ ## Dispatch
10
+ - Charge `github` AVANT de modifier les workflows, templates, ou la configuration GitHub.
11
+ - Si le workflow déploie → charge aussi `cicd-pipeline` et `release-management`.
12
+
13
+ ## Règles dures (zero tolerance)
14
+ - **Jamais** de secret dans les workflows. OIDC ou `secrets: inherit` uniquement.
15
+ - **Jamais** de push direct sur main. PR obligatoire + review + CI verte.
16
+ - **Jamais** de PR sans issue liée (Closes #N) et description structurée.
17
+
18
+ ## Conventions du projet
19
+ - Conventional Commits : `feat(scope):`, `fix(scope):`, `chore(scope):` — machine-readable.
20
+ - Branches ≤ 1 jour : `feat/`, `fix/`, `chore/`.
21
+ - PR < 400 lignes avec test plan.
22
+ - Templates d'issue (bug.yml, feature.yml) et de PR (pull_request_template.md).
@@ -0,0 +1,23 @@
1
+ ---
2
+ paths:
3
+ - "**/logging*"
4
+ - "**/*Logger*"
5
+ - "**/*log*"
6
+ - "**/logback*"
7
+ - "**/log4j*"
8
+ - "**/winston*"
9
+ ---
10
+
11
+ ## Dispatch
12
+ - Charge `logging` AVANT de configurer les logs.
13
+ - Si les logs contiennent des PII → charge aussi `appsec`.
14
+
15
+ ## Regles dures (zero tolerance)
16
+ - **Jamais** de PII/token/secret dans les logs. Scrub automatique.
17
+ - **Jamais** de `console.log` en prod. Structured logging uniquement.
18
+ - **Jamais** de log level DEBUG en prod par defaut.
19
+
20
+ ## Conventions du projet
21
+ - JSON structure : `{timestamp, level, logger, message, correlationId, ...context}`.
22
+ - Correlation ID sur chaque requete — propage a tous les services.
23
+ - Log levels : ERROR (alerte), WARN (investiguer), INFO (decisions metier), DEBUG (detail).
@@ -0,0 +1,25 @@
1
+ ---
2
+ paths:
3
+ - "**/metrics*"
4
+ - "**/*Metrics*"
5
+ - "**/health*"
6
+ - "**/*Health*"
7
+ - "**/dashboards/**"
8
+ - "**/alerts*"
9
+ - "**/prometheus*"
10
+ - "**/grafana*"
11
+ ---
12
+
13
+ ## Dispatch
14
+ - Charge `monitoring` AVANT de configurer des metriques ou alertes.
15
+ - Si les alertes sont pour la securite → charge aussi `appsec`.
16
+
17
+ ## Regles dures (zero tolerance)
18
+ - **Jamais** d'alerte sans runbook. Chaque alerte a un lien vers la procedure.
19
+ - **Jamais** de metrique sans cardinalite bornee. Pas de user ID comme label.
20
+ - **Jamais** de `alert: always` sans fenetre de silence.
21
+
22
+ ## Conventions du projet
23
+ - RED metrics pour les services : Rate, Errors, Duration.
24
+ - USE metrics pour l'infra : Utilization, Saturation, Errors.
25
+ - Dashboards : 4 golden signals (latency, traffic, errors, saturation).
@@ -0,0 +1,20 @@
1
+ ---
2
+ paths:
3
+ - "SKILL.md"
4
+ - "**/SKILL.md"
5
+ - ".claude/skills/**"
6
+ ---
7
+
8
+ ## Dispatch
9
+ - Charge `research` AVANT toute recherche d'information externe (WebSearch, WebFetch, documentation).
10
+ - Charge `research` quand tu crées ou modifies un skill (les skills encodent des connaissances, la recherche vérifie leur exactitude).
11
+
12
+ ## Règles dures (zero tolerance)
13
+ - **Jamais** citer une API ou option sans vérification dans la doc officielle correspondant à la version utilisée.
14
+ - **Jamais** adopter une solution d'une seule source. Minimum deux sources indépendantes pour l'information critique.
15
+ - **Jamais** ignorer les issues fermées GitHub — elles contiennent les solutions.
16
+
17
+ ## Conventions du projet
18
+ - Hiérarchie des sources : doc officielle > code source > changelog > issues GitHub > StackOverflow > blogs > LLM.
19
+ - Vérification de version systématique avant d'appliquer une doc.
20
+ - Toute information critique documentée avec ses sources (URL + date de consultation).
@@ -43,10 +43,6 @@
43
43
  {
44
44
  "matcher": "Edit|Write",
45
45
  "hooks": [
46
- {
47
- "type": "command",
48
- "command": "! [ -x \"$CLAUDE_PROJECT_DIR/.claude/hooks/check-test-first.sh\" ] || \"$CLAUDE_PROJECT_DIR/.claude/hooks/check-test-first.sh\""
49
- },
50
46
  {
51
47
  "type": "command",
52
48
  "command": "! [ -x \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-tool-write.sh\" ] || \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-tool-write.sh\""
@@ -89,48 +85,6 @@
89
85
  {
90
86
  "type": "command",
91
87
  "command": "! [ -x \"$CLAUDE_PROJECT_DIR/.claude/hooks/track-file.sh\" ] || \"$CLAUDE_PROJECT_DIR/.claude/hooks/track-file.sh\""
92
- },
93
- {
94
- "type": "command",
95
- "command": "COUNT=$(cat \"${CLAUDE_PROJECT_DIR:-$PWD}/.ciel/tracked-files.json\" 2>/dev/null | python3 -c \"import sys,json; d=json.load(sys.stdin); print(len(d))\" 2>/dev/null || echo \"?\"); echo \"[CIEL] Tracked files: $COUNT — RELIRE recommended at 5+ files or on Critical paths\" >&2"
96
- }
97
- ]
98
- },
99
- {
100
- "matcher": "Skill|Agent",
101
- "hooks": [
102
- {
103
- "type": "command",
104
- "command": "! [ -x \"$CLAUDE_PROJECT_DIR/.claude/hooks/track-pipeline.sh\" ] || \"$CLAUDE_PROJECT_DIR/.claude/hooks/track-pipeline.sh\""
105
- }
106
- ]
107
- }
108
- ],
109
- "SubagentStart": [
110
- {
111
- "matcher": "ciel-explorer",
112
- "hooks": [
113
- {
114
- "type": "command",
115
- "command": "echo \"$(date +%s)\" > \"/tmp/ciel_dispatched.$$\" && echo \"[CIEL] Explorer started: $(date -u +%Y-%m-%dT%H:%M:%SZ)\" >> \"$CLAUDE_PROJECT_DIR/.ciel/exploration-log.md\""
116
- }
117
- ]
118
- },
119
- {
120
- "matcher": "ciel-researcher",
121
- "hooks": [
122
- {
123
- "type": "command",
124
- "command": "echo \"$(date +%s)\" > \"/tmp/ciel_dispatched.$$\" && echo \"[CIEL] Researcher started: $(date -u +%Y-%m-%dT%H:%M:%SZ)\" >> \"$CLAUDE_PROJECT_DIR/.ciel/subagent-log.md\""
125
- }
126
- ]
127
- },
128
- {
129
- "matcher": "ciel-critic",
130
- "hooks": [
131
- {
132
- "type": "command",
133
- "command": "echo \"$(date +%s)\" > \"/tmp/ciel_dispatched.$$\" && echo \"[CIEL] Critic started: $(date -u +%Y-%m-%dT%H:%M:%SZ)\" >> \"$CLAUDE_PROJECT_DIR/.ciel/subagent-log.md\""
134
88
  }
135
89
  ]
136
90
  }
@@ -140,17 +94,7 @@
140
94
  "hooks": [
141
95
  {
142
96
  "type": "command",
143
- "command": "! [ -x \"$CLAUDE_PROJECT_DIR/.claude/hooks/meta-critiquer.sh\" ] || \"$CLAUDE_PROJECT_DIR/.claude/hooks/meta-critiquer.sh\""
144
- }
145
- ]
146
- }
147
- ],
148
- "SubagentStop": [
149
- {
150
- "hooks": [
151
- {
152
- "type": "command",
153
- "command": "! [ -x \"$CLAUDE_PROJECT_DIR/.claude/hooks/meta-critiquer.sh\" ] || \"$CLAUDE_PROJECT_DIR/.claude/hooks/meta-critiquer.sh\""
97
+ "command": "! [ -x \"$CLAUDE_PROJECT_DIR/.claude/hooks/stop.sh\" ] || \"$CLAUDE_PROJECT_DIR/.claude/hooks/stop.sh\""
154
98
  }
155
99
  ]
156
100
  }
@@ -160,7 +104,7 @@
160
104
  "hooks": [
161
105
  {
162
106
  "type": "command",
163
- "command": "mkdir -p \"$CLAUDE_PROJECT_DIR/.ciel\" && echo \"[CIEL] Pre-compact: $(date -u +%Y-%m-%dT%H:%M:%SZ)\" >> \"$CLAUDE_PROJECT_DIR/.ciel/compact-log.md\""
107
+ "command": "mkdir -p \"$CLAUDE_PROJECT_DIR/.ciel\""
164
108
  }
165
109
  ]
166
110
  }