@neikyun/ciel 6.11.2 → 6.13.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 (125) hide show
  1. package/assets/.claude/agents/ciel-critic.md +71 -12
  2. package/assets/.claude/agents/ciel-explorer.md +59 -18
  3. package/assets/.claude/agents/ciel-improver.md +6 -3
  4. package/assets/.claude/agents/ciel-researcher.md +85 -25
  5. package/assets/.claude/hooks/block-destructive.sh +2 -2
  6. package/assets/.claude/hooks/check-test-first.sh +2 -2
  7. package/assets/.claude/hooks/memory-bootstrap.sh +0 -0
  8. package/assets/.claude/hooks/memory-engine.py +82 -15
  9. package/assets/.claude/hooks/post-tool-write.sh +32 -0
  10. package/assets/.claude/hooks/pre-agent-gate.sh +11 -6
  11. package/assets/.claude/hooks/pre-compact.sh +18 -0
  12. package/assets/.claude/hooks/pre-tool-write.sh +56 -31
  13. package/assets/.claude/hooks/session-start.sh +22 -1
  14. package/assets/.claude/hooks/session-version-check.sh +1 -1
  15. package/assets/.claude/hooks/stop.sh +104 -0
  16. package/assets/.claude/hooks/subagent-stop.sh +54 -0
  17. package/assets/.claude/hooks/track-file.sh +2 -2
  18. package/assets/.claude/hooks/user-prompt-submit.sh +11 -15
  19. package/assets/.claude/settings.json +18 -4
  20. package/assets/AGENTS.md +1 -1
  21. package/assets/CLAUDE.md +103 -175
  22. package/assets/commands/ciel-audit.md +58 -399
  23. package/assets/commands/ciel-create-skill.md +24 -38
  24. package/assets/commands/ciel-eval.md +25 -37
  25. package/assets/commands/ciel-init.md +36 -126
  26. package/assets/commands/ciel-status.md +22 -19
  27. package/assets/commands/ciel-update.md +20 -39
  28. package/assets/platforms/opencode/.opencode/agents/ciel-researcher.md +71 -895
  29. package/assets/platforms/opencode/.opencode/commands/ciel-audit.md +58 -296
  30. package/assets/platforms/opencode/.opencode/commands/ciel-create-skill.md +24 -46
  31. package/assets/platforms/opencode/.opencode/commands/ciel-eval.md +25 -45
  32. package/assets/platforms/opencode/.opencode/commands/ciel-init.md +36 -131
  33. package/assets/platforms/opencode/.opencode/commands/ciel-status.md +22 -24
  34. package/assets/platforms/opencode/.opencode/commands/ciel-update.md +20 -40
  35. package/assets/platforms/opencode/AGENTS.md +4 -4
  36. package/assets/rules/security.md +30 -0
  37. package/assets/rules/testing.md +23 -0
  38. package/assets/skills/agile/SKILL.md +42 -0
  39. package/assets/skills/alerting/SKILL.md +55 -0
  40. package/assets/skills/api-design/SKILL.md +46 -0
  41. package/assets/skills/appsec/SKILL.md +43 -0
  42. package/assets/skills/architecture/SKILL.md +74 -0
  43. package/assets/skills/backend/SKILL.md +41 -0
  44. package/assets/skills/backup-recovery/SKILL.md +42 -0
  45. package/assets/skills/caching/SKILL.md +44 -0
  46. package/assets/skills/cdn/SKILL.md +42 -0
  47. package/assets/skills/chaos/SKILL.md +41 -0
  48. package/assets/skills/cicd-pipeline/SKILL.md +56 -0
  49. package/assets/skills/cloud/SKILL.md +42 -0
  50. package/assets/skills/code-quality/SKILL.md +42 -0
  51. package/assets/skills/code-review/SKILL.md +41 -0
  52. package/assets/skills/communication/SKILL.md +42 -0
  53. package/assets/skills/containers/SKILL.md +42 -0
  54. package/assets/skills/cqrs/SKILL.md +41 -0
  55. package/assets/skills/crypto/SKILL.md +46 -0
  56. package/assets/skills/data-engineering/SKILL.md +42 -0
  57. package/assets/skills/database-design/SKILL.md +46 -0
  58. package/assets/skills/ddd/SKILL.md +45 -0
  59. package/assets/skills/deployment-strategies/SKILL.md +51 -0
  60. package/assets/skills/desktop/SKILL.md +42 -0
  61. package/assets/skills/devsecops/SKILL.md +43 -0
  62. package/assets/skills/event-driven/SKILL.md +46 -0
  63. package/assets/skills/frontend/SKILL.md +41 -0
  64. package/assets/skills/functional/SKILL.md +42 -0
  65. package/assets/skills/high-availability/SKILL.md +42 -0
  66. package/assets/skills/iac/SKILL.md +46 -0
  67. package/assets/skills/logging/SKILL.md +46 -0
  68. package/assets/skills/meta/ciel-improve/SKILL.md +127 -0
  69. package/assets/skills/meta/learnings-capture/SKILL.md +105 -0
  70. package/assets/skills/meta/patch-spec/patch-spec.md +50 -0
  71. package/assets/skills/meta/skill-creator/SKILL.md +115 -0
  72. package/assets/skills/meta/skill-freshness-auditor/SKILL.md +164 -0
  73. package/assets/skills/meta/skill-variant-evaluator/SKILL.md +100 -0
  74. package/assets/skills/meta/skills-first-design-auditor/SKILL.md +192 -0
  75. package/assets/skills/ml-engineering/SKILL.md +42 -0
  76. package/assets/skills/mobile/SKILL.md +42 -0
  77. package/assets/skills/monitoring/SKILL.md +54 -0
  78. package/assets/skills/networking/SKILL.md +42 -0
  79. package/assets/skills/nosql/SKILL.md +41 -0
  80. package/assets/skills/oop-solid/SKILL.md +42 -0
  81. package/assets/skills/performance/SKILL.md +41 -0
  82. package/assets/skills/reactive/SKILL.md +42 -0
  83. package/assets/skills/release-management/SKILL.md +51 -0
  84. package/assets/skills/research/fact-check-claims/SKILL.md +98 -0
  85. package/assets/skills/research/research-forums/SKILL.md +103 -0
  86. package/assets/skills/research/research-github-issues/SKILL.md +103 -0
  87. package/assets/skills/research/research-web-sources/SKILL.md +108 -0
  88. package/assets/skills/research/synthesize-findings/SKILL.md +112 -0
  89. package/assets/skills/research/validate-source-credibility/SKILL.md +103 -0
  90. package/assets/skills/resilience/SKILL.md +41 -0
  91. package/assets/skills/serverless/SKILL.md +42 -0
  92. package/assets/skills/servers/SKILL.md +41 -0
  93. package/assets/skills/sql/SKILL.md +45 -0
  94. package/assets/skills/supply-chain/SKILL.md +41 -0
  95. package/assets/skills/system-design/SKILL.md +91 -0
  96. package/assets/skills/tech-leadership/SKILL.md +46 -0
  97. package/assets/skills/testing/SKILL.md +41 -0
  98. package/assets/skills/tracing/SKILL.md +36 -0
  99. package/assets/skills/utility/branch-cleaner/SKILL.md +195 -0
  100. package/assets/skills/utility/branch-setup/SKILL.md +144 -0
  101. package/assets/skills/utility/changelog-updater/SKILL.md +125 -0
  102. package/assets/skills/utility/commit-writer/SKILL.md +154 -0
  103. package/assets/skills/utility/issue-closer/SKILL.md +106 -0
  104. package/assets/skills/utility/issue-creator/SKILL.md +200 -0
  105. package/assets/skills/utility/pr-merger/SKILL.md +189 -0
  106. package/assets/skills/utility/pr-opener/SKILL.md +180 -0
  107. package/assets/skills/utility/release-publisher/SKILL.md +224 -0
  108. package/assets/skills/workflow/ciel-dev-process/SKILL.md +94 -0
  109. package/assets/skills/workflow/faire-gatekeeper/SKILL.md +3 -1
  110. package/assets/skills/workflow/prouver-verifier/SKILL.md +11 -2
  111. package/dist/cli/check.d.ts.map +1 -1
  112. package/dist/cli/check.js +11 -2
  113. package/dist/cli/check.js.map +1 -1
  114. package/dist/cli/claude.d.ts.map +1 -1
  115. package/dist/cli/claude.js +0 -2
  116. package/dist/cli/claude.js.map +1 -1
  117. package/dist/cli/init.d.ts.map +1 -1
  118. package/dist/cli/init.js +11 -2
  119. package/dist/cli/init.js.map +1 -1
  120. package/dist/cli/opencode.d.ts.map +1 -1
  121. package/dist/cli/opencode.js +2 -1
  122. package/dist/cli/opencode.js.map +1 -1
  123. package/package.json +1 -1
  124. package/assets/commands/ciel-migrate.md +0 -35
  125. package/assets/commands/ciel-refresh.md +0 -91
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: iac
3
+ description: "IaC — l'infrastructure comme code, pas comme clics. State management, drift detection, modules, immutabilite. A charger quand on definit ou modifie l'infrastructure."
4
+ ---
5
+
6
+ # Infrastructure as Code
7
+
8
+ **Principe premier :** L'infrastructure n'est pas une liste de ressources a creer — c'est un programme dont le state est la verite. La console est un outil de debugging, pas de gestion. Chaque clic est une dette qui sera oubliee et qui cassera au pire moment. Le vrai benefice de l'IaC n'est pas la vitesse de creation (la console est plus rapide pour 1 instance) — c'est la repetabilite : meme code → meme infra, dans 6 mois, par un autre humain, sans surprise. Le state file est ton inventaire physique — si tu le perds, tu reconstruis ou tu importes, mais tu ne devines pas.
9
+
10
+ ## Checklist
11
+ - [ ] Toute l'infrastructure est dans le code — zero ressource creee a la main (verifie avec drift detection)
12
+ - [ ] Le state est stocke dans un backend securise (S3 + DynamoDB lock, Terraform Cloud, Pulumi SaaS) — jamais en local
13
+ - [ ] Les modules sont versionnes (tag git, pas `source = "../common"`)
14
+ - [ ] Les ressources sont immutables — on remplace, on ne modifie pas en place
15
+ - [ ] Les secrets sont referencees depuis un secret manager, pas en clair dans le code
16
+ - [ ] Le plan est toujours sauvegarde (`terraform plan -out=plan.out`) et applique depuis le meme fichier
17
+ - [ ] Drift detection tourne regulierement (hebdomadaire ou dans la CI) — alerter si ecart
18
+
19
+ ## Anti-patterns
20
+ ### Console comme outil principal
21
+ **Ce qu'on voit :** l'equipe cree les ressources a la main "parce que c'est plus rapide". 6 mois plus tard, 200 ressources non trackees, configuration inconnue.
22
+ **Pourquoi c'est dangereux :** la console ne laisse pas de trace. Pas de review possible. Pas de rollback. Impossible de reproduire l'environnement. Le disaster recovery devient un puzzle.
23
+ **Faire plutot :** toute ressource est definie dans le code. Si une ressource existe deja, l'importer (`terraform import`) puis la gerer en code. La console est en read-only.
24
+
25
+ ### State local
26
+ **Ce qu'on voit :** `terraform.tfstate` dans le repo ou sur le laptop du dev. "C'est bon, je l'ai en local."
27
+ **Pourquoi c'est dangereux :** le laptop meurt, le state est perdu. Deux devs appliquent en parallele → corruption. Le state contient des donnees sensibles (passwords, private keys) → fuite.
28
+ **Faire plutot :** backend distant avec locking (S3 + DynamoDB). Chaque `apply` verifie le lock. Le state est chiffre. Les secrets sont marques `sensitive` dans le code, pas extraits du state.
29
+
30
+ ### Module monolithe
31
+ **Ce qu'on voit :** un seul module `main.tf` de 2000 lignes qui gere tout : reseau, compute, DB, DNS, IAM. Chaque changement fait peur.
32
+ **Pourquoi c'est dangereux :** blast radius maximal. Un changement de DNS peut detruire la DB si le state est corrompu. La revue est impossible. Le `terraform plan` prend 10 minutes.
33
+ **Faire plutot :** infrastructure decomposee en modules independants. Reseau dans un state, compute dans un autre, DB dans un autre. Chaque module a son propre cycle de vie. Les dependances sont explicites (data sources, remote state).
34
+
35
+ ## Patterns
36
+ ### Immutabilite
37
+ **Quand :** toute ressource modifiable (instances, conteneurs, lambdas).
38
+ **Comment :** `create_before_destroy = true`. On cree la nouvelle ressource, on valide, puis on detruit l'ancienne. Pas de modification en place. Le code est la verite — si le code change, la ressource est remplacee.
39
+
40
+ ### Drift detection
41
+ **Quand :** toute equipe de plus d'une personne.
42
+ **Comment :** `terraform plan -detailed-exitcode` ou `pulumi refresh --diff` dans la CI chaque semaine. Si drift → ticket automatique. Corriger la cause (console ? script maison ?) pas juste l'effet.
43
+
44
+ ### GitOps
45
+ **Quand :** deploiement continu de l'infrastructure.
46
+ **Comment :** le repo git est la source de verite. Un merge sur main declenche le plan, puis l'apply. Pas de `terraform apply` depuis un laptop. Le pipeline a les permissions IAM minimales (OIDC).
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: logging
3
+ description: "Logging — structured JSON, correlation ID, PII scrubbing, centralized aggregation, log levels as signal. À charger quand on configure les logs."
4
+ ---
5
+
6
+ # Logging
7
+
8
+ **Principe premier :** Les logs ne sont pas pour toi — ils sont pour le "toi du futur" qui debug une erreur à 3h du matin sans contexte. Un log qui dit "Error occurred" est pire que pas de log — il donne l'illusion d'information. Chaque log doit répondre à : quoi, quand, où, qui, et pourquoi c'est arrivé. Le format est JSON structuré, pas du texte libre — parce que les logs seront parsés par des machines (Loki, ELK, Datadog) bien avant d'être lus par des humains.
9
+
10
+ ## Checklist
11
+ - [ ] Logs structurés JSON — pas de `console.log("texte libre " + variable)`
12
+ - [ ] Correlation ID (trace ID) injecté et transmis à travers tous les services
13
+ - [ ] Niveaux de log respectés : ERROR (action requise), WARN (attention), INFO (normal), DEBUG (détail)
14
+ - [ ] Stack trace + contexte (userId, orderId, params) dans chaque ERROR
15
+ - [ ] PII/secret scrubbing : jamais de password, token, carte bancaire, email dans les logs
16
+ - [ ] Centralisation : tous les logs vers un endpoint unique (Loki/ELK/CloudWatch)
17
+ - [ ] Rétention configurée : hot 7j, warm 30j, cold 1 an
18
+
19
+ ## Anti-patterns
20
+ ### Log texte libre
21
+ **Ce qu'on voit :** `console.log("User " + userId + " logged in at " + Date.now())`. Concaténation de strings.
22
+ **Pourquoi c'est dangereux :** impossible à parser automatiquement. Pas de champ structuré. Recherche et filtrage impossibles sans regex fragiles. Si le format change légèrement, tous les dashboards cassent.
23
+ **Faire plutôt :** `logger.info({ event: "user_login", userId, timestamp }, "User logged in")`. JSON structuré. Champs typés. Requêtable.
24
+
25
+ ### Pas de correlation ID
26
+ **Ce qu'on voit :** chaque service logue avec son propre ID. Impossible de suivre une requête à travers 3 microservices.
27
+ **Pourquoi c'est dangereux :** debug en microservices = ouvrir 3 terminaux, chercher manuellement des timestamps qui coïncident. Une requête lente = mystère complet.
28
+ **Faire plutôt :** correlation ID généré à l'entrée (API Gateway). Transmis dans chaque header HTTP. Logué dans chaque service. Une recherche = une requête = tous les logs.
29
+
30
+ ### Données sensibles dans les logs
31
+ **Ce qu'on voit :** `logger.error("Payment failed", { cardNumber, cvv, userId })`.
32
+ **Pourquoi c'est dangereux :** PCI-DSS violé. Données bancaires dans les logs. En cas de fuite des logs, toutes les cartes compromises. Les logs sont souvent moins protégés que la DB.
33
+ **Faire plutôt :** `logger.error("Payment failed", { paymentId, errorCode, userId })`. Jamais de PII ou secret. Scrub automatisé en cas de doute.
34
+
35
+ ## Patterns
36
+ ### Structured JSON logging
37
+ **Quand :** toute application.
38
+ **Comment :** chaque log = `{timestamp, level, message, service, correlationId, ...context}`. Parse, filtre, indexe par Loki/ELK. Requêtable : `{.level = "ERROR"} | json | ...`
39
+
40
+ ### Centralized aggregation
41
+ **Quand :** plus d'un service.
42
+ **Comment :** tous les logs → stdout (K8s/Docker) → Promtail (parse, label) → Loki (stocke) → Grafana (requete LogQL). Un seul endroit pour chercher. LogQL : `{service="api", level="error"} |= "payment" | json`. Depuis Grafana, lien direct : log → trace ID → Tempo → span exact.
43
+
44
+ ### Debug flow Grafana (metrics → logs → traces)
45
+ **Quand :** incident en production.
46
+ **Comment :** (1) Grafana dashboard : métrique RED rouge → clic sur le point → (2) "Explore logs" → LogQL filtré par temps + service → (3) extraire le trace ID du log → (4) Tempo : trace complète avec tous les spans. Sans intégration, ces 3 outils sont séparés. Avec Grafana, ils sont liés.
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: ciel-improve
3
+ description: Analyzes recent session transcripts to detect repeated failure modes, user corrections, and skill output truncation, then produces a patch-set proposing specific rewrites for Ciel skills. Never rewrites autonomously — always returns a patch-set for user approval.
4
+ allowed-tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ # ciel-improve — Meta-skill for self-improvement
8
+
9
+ ## What this covers
10
+ This is the heart of Ciel's self-modification subsystem. It reads conversation history, identifies where skills failed to trigger or produced weak output, and proposes concrete rewrites.
11
+
12
+ ## Core principle
13
+ **Never rewrite autonomously.** Every change is a proposal. The user approves each patch individually.
14
+
15
+ ## Inputs
16
+
17
+ - **Session transcripts**: last N session JSONL files (default N=10)
18
+ - **Current Ciel version**: `.version` SHA
19
+ - **Project learnings**: `.claude/learnings.md` (if exists)
20
+ - **Latest eval scores**: `evals/results/*.json` (if exist)
21
+
22
+ ## Process
23
+
24
+ ### 1. Parse transcripts
25
+
26
+ For each session JSONL, extract:
27
+ - User messages (what was asked)
28
+ - Tool calls (what was invoked)
29
+ - User corrections ("non", "that's wrong", "use X instead")
30
+ - Skill triggers (log lines `SkillInvoked: <name>`)
31
+
32
+ ### 2. Identify issues
33
+
34
+ Classify each turn:
35
+ - **UNTRIGGERED**: skill should have fired but didn't
36
+ - **MISTRIGGERED**: skill fired when it shouldn't have
37
+ - **TRUNCATED**: output < 200 tokens on non-trivial task
38
+ - **CORRECTED**: user explicitly corrected behavior
39
+ - **REPEATED**: same failure 2+ times across sessions
40
+
41
+ ### 3. Map issues to skills
42
+
43
+ For each issue, find the responsible skill:
44
+ - Description didn't match intent → patch description
45
+ - Output truncated → patch output constraints
46
+ - Correction repeated → patch to enforce corrected behavior
47
+
48
+ ### 4. Generate candidate rewrites
49
+
50
+ For each responsible skill, produce 2-3 candidates:
51
+ - **A**: baseline (current)
52
+ - **B**: tightened gates + more specific description
53
+ - **C**: reduced scope + clearer trigger phrasing
54
+
55
+ ### 5. Run `skill-variant-evaluator` on each candidate
56
+
57
+ Winner = highest aggregate binary score (tiebreak: lowest token usage).
58
+
59
+ ### 6. Produce patch-set
60
+
61
+ ```
62
+ ## Patch 1 — skills/<category>/<name>/SKILL.md
63
+ Issue: <REPEATED: user corrected "use pip not uv" 3 times>
64
+ Baseline score: 0.62 | Candidate B score: 0.89 (winner)
65
+
66
+ --- BEFORE (lines 15-20)
67
+ <old block>
68
+ --- AFTER
69
+ <new block>
70
+
71
+ Approve? [y/n/edit]
72
+ ```
73
+
74
+ ## Common patterns
75
+
76
+ ### Good improvement proposal
77
+
78
+ ```
79
+ # Ciel improvement proposals — 2026-04-23
80
+
81
+ Sessions analyzed: 5
82
+ Issues detected: 3
83
+ Patches proposed: 2
84
+
85
+ ## Patch 1 — skills/utility/commit-writer/SKILL.md
86
+ Issue: CORRECTED — user said "add issue reference" 3 times, skill didn't enforce it
87
+ Before: "If branch name matches pattern, add Closes #N"
88
+ After: "feat/fix commits MUST have Closes #N. If no issue detected, prompt user."
89
+
90
+ ## No-fix issues (user must decide)
91
+ - User prefers squash merges but pr-merger defaults to merge commit — preference, not bug
92
+ ```
93
+
94
+ ### Bad improvement proposal
95
+
96
+ ```
97
+ Found some issues. Fixed them.
98
+ ```
99
+
100
+ Problems: no patches, no scoring, no user approval, autonomous rewrite.
101
+
102
+ ## Anti-patterns
103
+
104
+ - **Autonomous rewrite** — NEVER write changes directly. Always propose patches.
105
+ - **> 5 patches per run** — too noisy. Pause and ask user.
106
+ - **Description rewrite > 200 chars** — prevents wholesale rewrites
107
+ - **> 1 new skill per run** — prevents skill explosion
108
+ - **Proposing skill deletion** — user decides manually
109
+ - **Breaking YAML** — every patch must preserve valid frontmatter
110
+
111
+ ## How to verify
112
+
113
+ - [ ] Sessions parsed (≥ 1 transcript read)?
114
+ - [ ] Issues classified (UNTRIGGERED/MISTRIGGERED/TRUNCATED/CORRECTED/REPEATED)?
115
+ - [ ] Each issue mapped to a responsible skill?
116
+ - [ ] Candidates generated (2-3 per issue)?
117
+ - [ ] Patch-set returned (not applied)?
118
+ - [ ] Patch count ≤ 5?
119
+ - [ ] YAML frontmatter preserved in all patches?
120
+
121
+ ## When triggered
122
+
123
+ - User runs `/ciel-improve`
124
+ - User asks "can you improve yourself?" or "analyze my recent sessions"
125
+ - `improver` agent invokes this skill
126
+
127
+ Do NOT trigger on every task — this is an infrequent meta operation.
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: learnings-capture
3
+ description: Mines the recent conversation for user corrections and failure modes, extracts MISTAKE→RULE pairs, and appends them to .claude/learnings.md or ciel-overlay.md. Invoked automatically at session boundaries. Deduplicates against existing entries.
4
+ allowed-tools: Read, Bash
5
+ ---
6
+
7
+ # learnings-capture — Auto-capture session learnings
8
+
9
+ ## What this covers
10
+ Closes the feedback loop: every user correction or failure mode observed in a session becomes a persistent rule that Ciel applies in future sessions.
11
+
12
+ ## Core principle
13
+ **Every correction is a learning opportunity.** If the user said "no, use X" — that becomes a rule. If a test failed because of Y — that becomes a rule. Capture it before the session ends.
14
+
15
+ ## Inputs
16
+
17
+ - **conversation-scope**: last N turns to analyze (default 20)
18
+ - **target-file**: `local` → `.claude/learnings.md` | `project` → `ciel-overlay.md` | `auto` (default)
19
+
20
+ ## Process
21
+
22
+ ### 1. Scan recent turns
23
+
24
+ Read the last 20 turns. Skip if < 5 turns.
25
+
26
+ ### 2. Extract signals
27
+
28
+ - **User corrections**: "no, use X", "stop doing Y", "always X", "never Y"
29
+ - **Failure modes**: test failures, CI red, "the fix broke X"
30
+ - **Positive patterns**: "that worked", "keep doing X"
31
+
32
+ ### 3. Formulate MISTAKE → RULE pairs
33
+
34
+ ```
35
+ [<date>] MISTAKE: <what happened> → RULE: <how to avoid it>
36
+ ```
37
+
38
+ Example:
39
+ ```
40
+ [2026-04-23] MISTAKE: used `npm install` despite project using Bun → RULE: check for bun.lockb before picking package manager
41
+ ```
42
+
43
+ ### 4. Classify scope
44
+
45
+ - **local** — project-agnostic → `.claude/learnings.md`
46
+ - **project** — tied to this project's stack → `ciel-overlay.md`
47
+
48
+ ### 5. Deduplicate
49
+
50
+ Check if RULE portion (normalized) already exists. Skip if duplicate.
51
+
52
+ ### 6. Append
53
+
54
+ Append new pairs at bottom of target file under `## Leçons projet` or `## Learnings`.
55
+
56
+ ## Common patterns
57
+
58
+ ### Good learning capture
59
+
60
+ ```
61
+ # Session learnings captured
62
+
63
+ Turns analyzed: 15
64
+ Signals detected: 3
65
+ New pairs: 2
66
+ Duplicates skipped: 1
67
+
68
+ ## Appended to ciel-overlay.md
69
+ - [2026-04-23] MISTAKE: used vi.mock() for internal service → RULE: use vi.spyOn() for internal logic, vi.mock() only for external I/O
70
+ - [2026-04-23] MISTAKE: committed .env file → RULE: check git diff --cached for .env before commit
71
+ ```
72
+
73
+ ### Bad learning capture
74
+
75
+ ```
76
+ Captured some learnings.
77
+ ```
78
+
79
+ Problems: no pairs, no dedup, no classification.
80
+
81
+ ## Anti-patterns
82
+
83
+ - **Overwriting** — always append, never overwrite
84
+ - **Deleting** — even "wrong" learnings stay
85
+ - **Dedup threshold too low** — 80% lexical similarity = duplicate
86
+ - **> 10 pairs per session** — pick top 10, skip rest
87
+ - **PII captured** — filter passwords, tokens, emails before writing
88
+ - **No timestamp** — use `[YYYY-MM-DD]` format
89
+
90
+ ## How to verify
91
+
92
+ - [ ] ≥ 1 turn analyzed?
93
+ - [ ] Signals detected and classified?
94
+ - [ ] MISTAKE → RULE pairs formatted correctly?
95
+ - [ ] Scope classified (local/project)?
96
+ - [ ] Deduplication performed?
97
+ - [ ] PII filtered out?
98
+ - [ ] Pairs appended (not overwritten)?
99
+
100
+ ## When triggered
101
+
102
+ - `Stop` hook fires at session end
103
+ - `PreCompact` hook fires before context compaction
104
+ - User says "capture what we just learned"
105
+ - `meta-critiquer` invokes at step 3 (user correction detected)
@@ -0,0 +1,50 @@
1
+ # Patch-Set Format Specification
2
+
3
+ Shared output format for `ciel-improve` (transcript-driven skill rewrites) and `skill-freshness-auditor` (external-reference freshness). Both produce the same structure for user approval.
4
+
5
+ ## Format
6
+
7
+ Each patch-set is a markdown file with sections. One patch per change, never batched.
8
+
9
+ ```
10
+ ## Patch <N>/<TOTAL>: <brief description>
11
+
12
+ ### File
13
+ <relative path to the SKILL.md or file>
14
+
15
+ ### Change
16
+ <what to add, remove, or modify — exact text>
17
+
18
+ ### Rationale
19
+ <why this change improves the skill — 1-2 sentences>
20
+
21
+ ### Evidence
22
+ <for freshness: the source URL + what changed>
23
+ <for improve: the transcript excerpt that triggered this>
24
+ ```
25
+
26
+ ## Rules
27
+
28
+ 1. **Max 5 patches per run** — a larger change means the skill needs a rewrite, not patches
29
+ 2. **One patch per concern** — never batch unrelated changes into one patch
30
+ 3. **Relative paths only** — never absolute paths
31
+ 4. **No auto-apply** — patches are for user approval only
32
+ 5. **Evidence is mandatory** — without evidence, the patch is speculation
33
+
34
+ ## Example
35
+
36
+ ```
37
+ ## Patch 1/3: Update Playwright MCP version pin
38
+
39
+ ### File
40
+ skills/domain/mcp-configurator/SKILL.md
41
+
42
+ ### Change
43
+ Replace `@playwright/mcp@latest` with `@playwright/mcp@1.52.0`
44
+
45
+ ### Rationale
46
+ v1.52.0 added `browser_drop` tool, fixing a gap in file upload workflow.
47
+
48
+ ### Evidence
49
+ https://github.com/microsoft/playwright-mcp/releases/tag/v1.52.0
50
+ ```
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: skill-creator
3
+ description: Creates a new Ciel skill from a conversation pattern or explicit user request. Validates kebab-case naming, YAML frontmatter, file size limits, and progressive-disclosure structure. Returns proposed SKILL.md for user approval — never writes directly.
4
+ allowed-tools: Read, Glob, Bash
5
+ ---
6
+
7
+ # skill-creator — Meta-skill for skill creation
8
+
9
+ ## What this covers
10
+ Generates a valid SKILL.md scaffold following Ciel's conventions. Returns a diff for user approval, then applies it if approved.
11
+
12
+ ## Core principle
13
+ **Skills are discovered, not registered.** The `description` field is the skill's search key. If it's vague, the skill won't trigger.
14
+
15
+ ## Inputs
16
+
17
+ - **name**: kebab-case, max 64 chars, unique
18
+ - **category**: `workflow`, `research`, `domain`, `utility`, `meta`
19
+ - **purpose**: one-line description (becomes `description` foundation)
20
+ - **context-fork?**: needs isolated fork context? (boolean)
21
+ - **tools-needed**: subset of available tools
22
+
23
+ ## Validation pipeline
24
+
25
+ ### 1. Name validation
26
+
27
+ - Regex: `^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$`
28
+ - Reserved: reject `anthropic`, `claude`, `mcp` prefixes
29
+ - Uniqueness: check existing skills — no collision
30
+ - Category prefix: warn if redundant (e.g. `workflow-foo` in `workflow/`)
31
+
32
+ ### 2. Description generation
33
+
34
+ - Third person: "Analyzes X" ✓ / "I analyze X" ✗
35
+ - Front-load use case + trigger keywords
36
+ - Include "Use when..." clause
37
+ - ≤ 1024 chars, recommended 200-500
38
+
39
+ ### 3. Scaffold SKILL.md
40
+
41
+ ```markdown
42
+ ---
43
+ name: <name>
44
+ description: <generated description>
45
+ [allowed-tools: <tools> — only if non-default]
46
+ [context: fork — only if needed]
47
+ [agent: <agent-type> — only if context: fork]
48
+ ---
49
+
50
+ # <human-readable name>
51
+
52
+ <1-2 sentence overview>
53
+
54
+ ---
55
+
56
+ ## Inputs
57
+ <expected inputs>
58
+
59
+ ## Process
60
+ <steps>
61
+
62
+ ## Output format
63
+ <expected output shape>
64
+
65
+ ## Guardrails
66
+ <rules>
67
+
68
+ ## When triggered
69
+ <triggers>
70
+ ```
71
+
72
+ ### 4. Optional reference.md
73
+
74
+ If user indicates need for extended content, generate `reference.md` alongside SKILL.md. Only ONE level of reference, never nested.
75
+
76
+ ## Common patterns
77
+
78
+ ### Good skill description
79
+
80
+ ```yaml
81
+ description: Generates 3 hostile critiques per changed file (1 functional, 1 import, 1 data-assumption) and resolves each with FIX/ACCEPT/DEFER. Invoked by the critic agent on Write/Edit for Standard/Critical tasks with 3+ changed files.
82
+ ```
83
+
84
+ ### Bad skill description
85
+
86
+ ```yaml
87
+ description: Helps with code review.
88
+ ```
89
+
90
+ Problems: no trigger, no output, no specificity.
91
+
92
+ ## Anti-patterns
93
+
94
+ - **Max 1 new skill per invocation** — prevents skill explosion
95
+ - **SKILL.md ≤ 300 lines** — aim for 100-200
96
+ - **reference.md ≤ 500 lines**
97
+ - **Duplication check** — if ≥ 70% keyword overlap with existing skill, warn
98
+ - **Never create**: `claude-*`, `anthropic-*`, `mcp-*` names
99
+ - **Always preserve**: valid YAML frontmatter
100
+
101
+ ## How to verify
102
+
103
+ - [ ] Name valid kebab-case, ≤ 64 chars, unique?
104
+ - [ ] Category is one of the 5 valid categories?
105
+ - [ ] Description: third person, ≤ 1024 chars, includes trigger?
106
+ - [ ] SKILL.md ≤ 300 lines?
107
+ - [ ] No overlap with existing skills (grep checked)?
108
+ - [ ] YAML frontmatter valid?
109
+ - [ ] Catalog entry appended to reference.md?
110
+
111
+ ## When triggered
112
+
113
+ - User runs `/ciel-create-skill <name> <purpose>`
114
+ - `ciel-improve` detects a pattern worth extracting
115
+ - User says "create a skill for X" or "turn this into a skill"
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: skill-freshness-auditor
3
+ description: Scans every Ciel skill (SKILL.md + reference.md) for stale external references — outdated library version pins, dead URLs, superseded research citations — and produces a freshness patch-set proposing specific rewrites for user approval. Complements `ciel-improve` (transcript-driven) by catching drift from the outside world instead of from observed failures. Never auto-rewrites; always returns a patch-set.
4
+ allowed-tools: Read, Grep, Glob, Bash, WebFetch, WebSearch
5
+ ---
6
+
7
+ # skill-freshness-auditor — Keep skills current against external reality
8
+
9
+ Skills age through two channels: (a) **inside** — user corrections, observed failures, truncation (handled by `ciel-improve`); and (b) **outside** — the library you pinned shipped a new major, the official docs URL moved, the research paper you cited was superseded. This skill owns channel (b).
10
+
11
+ Output is always a proposal — user approves each patch before it writes to disk.
12
+
13
+ ---
14
+
15
+ ## Inputs
16
+
17
+ - **skills-root**: defaults to `$CIEL_DIR/skills/` (or `./skills/` if running against a clone). Optionally filter via `--scope=<category>` (workflow/research/domain/utility/meta/ciel).
18
+ - **freshness-window**: defaults — URLs older than 18 months = warn, library majors older than 12 months = warn, research citations older than 24 months = warn. Overridable.
19
+ - **max-patches**: defaults 5 per run (same cap as `ciel-improve`).
20
+
21
+ ---
22
+
23
+ ## Process
24
+
25
+ ### 1. Enumerate skills
26
+
27
+ ```bash
28
+ find "$SKILLS_ROOT" -name SKILL.md -o -name reference.md
29
+ ```
30
+
31
+ For each file, record path + last-modified time (`git log -1 --format=%ai <path>` if in a repo, else mtime).
32
+
33
+ ### 2. Extract external references
34
+
35
+ Three categories (grep-based extraction per skill):
36
+
37
+ | Category | Regex / heuristic | Examples in existing skills |
38
+ |---|---|---|
39
+ | **URL** | `https?://[^\s)]+` | docs.anthropic.com, cli.github.com, raw.githubusercontent.com |
40
+ | **Library + version pin** | `\b([A-Za-z][\w\-./]+)\s+(v?\d+\.\d+(?:\.\d+)?)` OR table rows like `Playwright 1.49` | Vitest, Playwright, React, Ktor, Anthropic SDK |
41
+ | **Research citation** | `\b(STRATUS|CriticBench|IdentityChain|ThoughtWorks.*Tech Radar|OWASP Top \d+|WCAG [\d.]+|SLSA Level \d+) (\d{4})` | STRATUS 2024, ThoughtWorks Tech Radar April 2026 |
42
+
43
+ Store per-skill: `[(category, text, location), ...]`.
44
+
45
+ ### 3. Freshness check per reference
46
+
47
+ Dispatch three sub-procedures **in parallel** (one per category) to minimize wall-clock:
48
+
49
+ #### 3a. URL liveness
50
+ For each URL:
51
+ - `WebFetch url="$URL" prompt="Return just the HTTP status and Last-Modified header if shown."` — ≤ 200 tokens/check.
52
+ - Flag if: 404, 301/302 to unrelated domain, OR Last-Modified > freshness-window.
53
+
54
+ #### 3b. Library version drift
55
+ For each library + version pair:
56
+ - `WebSearch "<library> latest stable version 2026"` (or current year).
57
+ - Extract the latest major/minor from the first 2 results.
58
+ - Flag if: pinned major ≠ latest major (breaking-change gap) OR pinned minor < latest - 2 minors.
59
+
60
+ #### 3c. Research citation recency
61
+ For each citation:
62
+ - `WebSearch "<name> <year+1 or later> superseded revised v2"` — look for a newer version.
63
+ - Flag if: a newer paper/version exists AND is >6 months old (not a preprint hot off the press).
64
+
65
+ ### 4. Produce the freshness patch-set
66
+
67
+ For each flagged finding, emit ONE patch entry. Format identical to `ciel-improve` patches (reuses that skill's approval UX):
68
+
69
+ ```
70
+ ## Patch K — skills/<category>/<name>/SKILL.md — FRESHNESS-<subcategory>
71
+ Reference: `<exact text>` at line N
72
+ Finding: <1 sentence why it's stale — with freshness-source URL>
73
+ Severity: HIGH (broken) | MEDIUM (outdated) | LOW (minor)
74
+
75
+ --- BEFORE (line N)
76
+ <old line>
77
+ --- AFTER (proposed)
78
+ <new line with updated ref>
79
+
80
+ Approve? [y/n/edit]
81
+ ```
82
+
83
+ Per-severity handling:
84
+ - **HIGH** (broken): 404 URL, removed-from-npm library → proposed AFTER = best replacement found, or `[BROKEN — resolve manually]` marker
85
+ - **MEDIUM** (outdated): version drift 1 major behind, URL still-200-but-redirecting → AFTER = latest pin
86
+ - **LOW** (minor): minor-version drift only, research citation 2-3 years old but still current → AFTER = optional bump, or note in `## Last-audited` footer
87
+
88
+ ### 5. Track history
89
+
90
+ After each approved patch, append a line to `$CIEL_DIR/.freshness-log.jsonl`:
91
+
92
+ ```json
93
+ {"ts":"2026-04-17T14:30Z","skill":"skills/workflow/pattern-fitness-check/SKILL.md","ref":"Playwright 1.49","action":"bumped-to-1.53","audit_version":"2.4.5"}
94
+ ```
95
+
96
+ Skip re-auditing a ref whose log entry is < freshness-window old (cache hits — saves WebFetch budget across repeated runs).
97
+
98
+ ---
99
+
100
+ ## Output format
101
+
102
+ ```
103
+ # Ciel freshness audit — <ISO-8601 timestamp>
104
+
105
+ Skills scanned: <N>
106
+ References extracted: <M> (URLs: <u>, libs: <l>, citations: <c>)
107
+ Cache hits (recent): <h>
108
+ Network checks performed: <nc>
109
+ Findings: HIGH <h>, MEDIUM <m>, LOW <l>
110
+
111
+ ## Patches proposed (max 5)
112
+
113
+ ## Patch 1 — …
114
+ ## Patch 2 — …
115
+
116
+ ## Cached (skipped this run — last audit within freshness window)
117
+ - <path>:<line> <ref> (last checked <date>)
118
+
119
+ ## Unable to check (network / paywall / ambiguity)
120
+ - <path>:<line> <ref> — reason: <timeout | cloudflare | semantic ambiguity>
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Guardrails
126
+
127
+ - **Max 5 patches per run** — same cap as `ciel-improve`. Prevents noise; defer rest to next run.
128
+ - **Never autonomous rewrite** — every patch waits for `[y/n/edit]`. No exceptions.
129
+ - **Never downgrade a pin** — if a skill pins v2 and latest is v3, propose bump; never propose going to v1 based on noise.
130
+ - **Version-pin patches must cross-check** — before proposing "bump X from v1.2 to v1.5", fetch v1.5's changelog to ensure the feature the skill relies on still exists. An AI-hallucinated bump that breaks semantics is worse than a slightly-stale pin.
131
+ - **Research citation patches require a named superseding work** — never replace a citation with "(outdated)" alone; the new citation must be specific and fetchable.
132
+ - **Skip auto-patching `CHANGELOG.md`** — changelogs are append-only history; outdated refs there are a feature, not a bug.
133
+ - **Respect `--scope` filter** — if the user asks only for `workflow` skills, don't scan `domain` or `meta`.
134
+ - **Cache window override** — `--force` bypasses the 18-month URL cache (rerun everything).
135
+
136
+ ---
137
+
138
+ ## When triggered
139
+
140
+ - User runs `/ciel-refresh`
141
+ - User asks "are any skills stale?" or "check Ciel for outdated references"
142
+ - Scheduled monthly (recommended) — drift accumulates silently; a monthly pass keeps it bounded
143
+ - Before a major version bump — so the new version ships without stale pins
144
+
145
+ Do NOT trigger automatically on every task — this is a batched meta operation, ~1-3K tokens per skill scanned. Burns budget if over-invoked.
146
+
147
+ ---
148
+
149
+ ## How to verify
150
+
151
+ - [ ] Skills enumerated (find command ran)?
152
+ - [ ] External references extracted (URLs, libs, citations)?
153
+ - [ ] Freshness checks performed per category (URL liveness, version drift, citation recency)?
154
+ - [ ] Patch-set format matches ciel-improve (BEFORE/AFTER)?
155
+ - [ ] Patch count ≤ 5?
156
+ - [ ] Freshness log appended?
157
+ - [ ] Cache hits skipped (no redundant checks)?
158
+
159
+ ## Relation to other meta skills
160
+
161
+ - **`ciel-improve`** — transcript-driven; catches failures Ciel experienced. This skill catches reality changes Ciel has not yet tripped over.
162
+ - **`skills-first-design-auditor`** — structure-driven; validates frontmatter, length, examples. This skill validates *content currency*, not form.
163
+ - **`skill-variant-evaluator`** — A/B scorer. Not invoked here unless a patch is a semantic rewrite (version bump alone doesn't need evaluation).
164
+ - **`skill-creator`** — scaffolds new skills. This skill updates existing ones in place.