@uzysjung/agent-harness 26.149.0 → 26.151.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 (65) hide show
  1. package/README.ko.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/{chunk-YSW3OLH4.js → chunk-3QBHZUVB.js} +164 -66
  4. package/dist/chunk-3QBHZUVB.js.map +1 -0
  5. package/dist/index.js +397 -293
  6. package/dist/index.js.map +1 -1
  7. package/dist/trust-tier-drift.js +5 -1
  8. package/dist/trust-tier-drift.js.map +1 -1
  9. package/package.json +1 -1
  10. package/templates/CLAUDE.md +145 -164
  11. package/templates/agents/build-error-resolver.md +1 -1
  12. package/templates/agents/plan-checker.md +1 -1
  13. package/templates/agents/reviewer.md +4 -5
  14. package/templates/antigravity/AGENTS.md.template +3 -23
  15. package/templates/codex/AGENTS.md.template +5 -56
  16. package/templates/hooks/protect-files.sh +4 -0
  17. package/templates/hooks/session-start.sh +57 -3
  18. package/templates/opencode/AGENTS.md.template +4 -52
  19. package/templates/opencode/opencode.json.template +0 -8
  20. package/templates/rules/change-management.md +0 -1
  21. package/templates/rules/cli-development.md +1 -1
  22. package/templates/rules/doc-governance.md +2 -0
  23. package/templates/rules/git-policy.md +1 -1
  24. package/templates/rules/ship-checklist.md +3 -3
  25. package/templates/rules/test-policy.md +3 -8
  26. package/templates/settings.json +1 -16
  27. package/templates/skills/agent-introspection-debugging/SKILL.md +1 -1
  28. package/templates/skills/audit-harness-fit/README.md +113 -0
  29. package/templates/skills/audit-harness-fit/SKILL.md +64 -433
  30. package/templates/skills/audit-harness-fit/evals/scenarios.yaml +222 -0
  31. package/templates/skills/audit-harness-fit/references/apply.md +66 -0
  32. package/templates/skills/audit-harness-fit/references/audit.md +160 -0
  33. package/templates/skills/audit-harness-fit/references/populate.md +74 -0
  34. package/templates/skills/audit-harness-fit/references/verification.md +123 -0
  35. package/templates/skills/audit-service-gaps/SKILL.md +6 -7
  36. package/templates/skills/clear-korean-communication/SKILL.md +8 -13
  37. package/templates/skills/compaction-handoff/SKILL.md +29 -12
  38. package/templates/skills/external-model-consult/SKILL.md +13 -24
  39. package/templates/skills/model-orchestration/SKILL.md +18 -15
  40. package/templates/skills/natural-korean/SKILL.md +45 -0
  41. package/templates/skills/north-star/SKILL.md +4 -6
  42. package/templates/skills/north-star/references/roadmap-method.md +2 -2
  43. package/templates/skills/{task-brief → objective-brief}/SKILL.md +17 -18
  44. package/templates/skills/recurrence-prevention/SKILL.md +16 -16
  45. package/dist/chunk-YSW3OLH4.js.map +0 -1
  46. package/templates/agents/code-reviewer.md +0 -237
  47. package/templates/agents/security-reviewer.md +0 -108
  48. package/templates/hooks/task-brief-nudge.sh +0 -57
  49. package/templates/skills/audit-harness-fit/references/official-criteria.md +0 -367
  50. package/templates/skills/continuous-learning-v2/SKILL.md +0 -361
  51. package/templates/skills/continuous-learning-v2/agents/observer-loop.sh +0 -362
  52. package/templates/skills/continuous-learning-v2/agents/observer.md +0 -189
  53. package/templates/skills/continuous-learning-v2/agents/session-guardian.sh +0 -150
  54. package/templates/skills/continuous-learning-v2/agents/start-observer.sh +0 -252
  55. package/templates/skills/continuous-learning-v2/config.json +0 -8
  56. package/templates/skills/continuous-learning-v2/hooks/observe.sh +0 -585
  57. package/templates/skills/continuous-learning-v2/scripts/detect-project.sh +0 -322
  58. package/templates/skills/continuous-learning-v2/scripts/instinct-cli.py +0 -1956
  59. package/templates/skills/continuous-learning-v2/scripts/lib/homunculus-dir.sh +0 -31
  60. package/templates/skills/continuous-learning-v2/scripts/migrate-homunculus.sh +0 -68
  61. package/templates/skills/continuous-learning-v2/scripts/test_parse_instinct.py +0 -1420
  62. package/templates/skills/humanize-korean/SKILL.md +0 -228
  63. package/templates/skills/spec-scaling/SKILL.md +0 -89
  64. package/templates/skills/strategic-compact/SKILL.md +0 -145
  65. package/templates/skills/strategic-compact/suggest-compact.sh +0 -54
@@ -1,361 +0,0 @@
1
- ---
2
- name: continuous-learning-v2
3
- description: Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents. v2.1 adds project-scoped instincts to prevent cross-project contamination.
4
- metadata:
5
- origin: ECC
6
- version: 2.1.0
7
- ---
8
-
9
- # Continuous Learning v2.1 - Instinct
10
- -Based Architecture
11
-
12
- An advanced learning system that turns your Claude Code sessions into reusable knowledge through atomic "instincts" - small learned behaviors with confidence scoring.
13
-
14
- **v2.1** adds **project-scoped instincts** — React patterns stay in your React project, Python conventions stay in your Python project, and universal patterns (like "always validate input") are shared globally.
15
-
16
- ## When to Activate
17
-
18
- - Setting up automatic learning from Claude Code sessions
19
- - Configuring instinct-based behavior extraction via hooks
20
- - Tuning confidence thresholds for learned behaviors
21
- - Reviewing, exporting, or importing instinct libraries
22
- - Evolving instincts into full skills, commands, or agents
23
- - Managing project-scoped vs global instincts
24
- - Promoting instincts from project to global scope
25
-
26
- ## What's New in v2.1
27
-
28
- | Feature | v2.0 | v2.1 |
29
- |---------|------|------|
30
- | Storage | Global (`~/.claude/homunculus/`) | Project-scoped (`${XDG_DATA_HOME:-~/.local/share}/ecc-homunculus/projects/<hash>/`) |
31
- | Scope | All instincts apply everywhere | Project-scoped + global |
32
- | Detection | None | git remote URL / repo path |
33
- | Promotion | N/A | Project → global when seen in 2+ projects |
34
- | Commands | 4 (status/evolve/export/import) | 6 (+promote/projects) |
35
- | Cross-project | Contamination risk | Isolated by default |
36
-
37
- ## What's New in v2 (vs v1)
38
-
39
- | Feature | v1 | v2 |
40
- |---------|----|----|
41
- | Observation | Stop hook (session end) | PreToolUse/PostToolUse (100% reliable) |
42
- | Analysis | Main context | Background agent (Haiku) |
43
- | Granularity | Full skills | Atomic "instincts" |
44
- | Confidence | None | 0.3-0.9 weighted |
45
- | Evolution | Direct to skill | Instincts -> cluster -> skill/command/agent |
46
- | Sharing | None | Export/import instincts |
47
-
48
- ## The Instinct Model
49
-
50
- An instinct is a small learned behavior:
51
-
52
- ```yaml
53
- ---
54
- id: prefer-functional-style
55
- trigger: "when writing new functions"
56
- confidence: 0.7
57
- domain: "code-style"
58
- source: "session-observation"
59
- scope: project
60
- project_id: "a1b2c3d4e5f6"
61
- project_name: "my-react-app"
62
- ---
63
-
64
- # Prefer Functional Style
65
-
66
- ## Action
67
- Use functional patterns over classes when appropriate.
68
-
69
- ## Evidence
70
- - Observed 5 instances of functional pattern preference
71
- - User corrected class-based approach to functional on 2025-01-15
72
- ```
73
-
74
- **Properties:**
75
- - **Atomic** -- one trigger, one action
76
- - **Confidence-weighted** -- 0.3 = tentative, 0.9 = near certain
77
- - **Domain-tagged** -- code-style, testing, git, debugging, workflow, etc.
78
- - **Evidence-backed** -- tracks what observations created it
79
- - **Scope-aware** -- `project` (default) or `global`
80
-
81
- ## How It Works
82
-
83
- ```
84
- Session Activity (in a git repo)
85
- |
86
- | Hooks capture prompts + tool use (100% reliable)
87
- | + detect project context (git remote / repo path)
88
- v
89
- +---------------------------------------------+
90
- | projects/<project-hash>/observations.jsonl |
91
- | (prompts, tool calls, outcomes, project) |
92
- +---------------------------------------------+
93
- |
94
- | Observer agent reads (background, Haiku)
95
- v
96
- +---------------------------------------------+
97
- | PATTERN DETECTION |
98
- | * User corrections -> instinct |
99
- | * Error resolutions -> instinct |
100
- | * Repeated workflows -> instinct |
101
- | * Scope decision: project or global? |
102
- +---------------------------------------------+
103
- |
104
- | Creates/updates
105
- v
106
- +---------------------------------------------+
107
- | projects/<project-hash>/instincts/personal/ |
108
- | * prefer-functional.yaml (0.7) [project] |
109
- | * use-react-hooks.yaml (0.9) [project] |
110
- +---------------------------------------------+
111
- | instincts/personal/ (GLOBAL) |
112
- | * always-validate-input.yaml (0.85) [global]|
113
- | * grep-before-edit.yaml (0.6) [global] |
114
- +---------------------------------------------+
115
- |
116
- | /evolve clusters + /promote
117
- v
118
- +---------------------------------------------+
119
- | projects/<hash>/evolved/ (project-scoped) |
120
- | evolved/ (global) |
121
- | * commands/new-feature.md |
122
- | * skills/testing-workflow.md |
123
- | * agents/refactor-specialist.md |
124
- +---------------------------------------------+
125
- ```
126
-
127
- ## Project Detection
128
-
129
- The system automatically detects your current project:
130
-
131
- 1. **`CLAUDE_PROJECT_DIR` env var** (highest priority)
132
- 2. **`git remote get-url origin`** -- hashed to create a portable project ID (same repo on different machines gets the same ID)
133
- 3. **`git rev-parse --show-toplevel`** -- fallback using repo path (machine-specific)
134
- 4. **Global fallback** -- if no project is detected, instincts go to global scope
135
-
136
- Each project gets a 12-character hash ID (e.g., `a1b2c3d4e5f6`). A registry file at `${XDG_DATA_HOME:-~/.local/share}/ecc-homunculus/projects.json` maps IDs to human-readable names.
137
-
138
- ### Data Directory
139
-
140
- Continuous-learning-v2 stores observer data outside `~/.claude` so Claude Code's sensitive-path guard does not block background instinct writes:
141
-
142
- 1. `CLV2_HOMUNCULUS_DIR` when set to an absolute path
143
- 2. `$XDG_DATA_HOME/ecc-homunculus`
144
- 3. `$HOME/.local/share/ecc-homunculus`
145
-
146
- Existing users with data at `~/.claude/homunculus` can migrate once:
147
-
148
- ```bash
149
- bash skills/continuous-learning-v2/scripts/migrate-homunculus.sh
150
- ```
151
-
152
- ## Quick Start
153
-
154
- ### 1. Enable Observation Hooks
155
-
156
- **If installed as a plugin** (recommended):
157
-
158
- No extra `settings.json` hook block is required. Claude Code v2.1+ auto-loads the plugin `hooks/hooks.json`, and `observe.sh` is already registered there.
159
-
160
- If you previously copied `observe.sh` into `~/.claude/settings.json`, remove that duplicate `PreToolUse` / `PostToolUse` block. Duplicating the plugin hook causes double execution and `${CLAUDE_PLUGIN_ROOT}` resolution errors because that variable is only available inside plugin-managed `hooks/hooks.json` entries.
161
-
162
- **If installed manually** to `~/.claude/skills`, add this to your `~/.claude/settings.json`:
163
-
164
- ```json
165
- {
166
- "hooks": {
167
- "PreToolUse": [{
168
- "matcher": "*",
169
- "hooks": [{
170
- "type": "command",
171
- "command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh"
172
- }]
173
- }],
174
- "PostToolUse": [{
175
- "matcher": "*",
176
- "hooks": [{
177
- "type": "command",
178
- "command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh"
179
- }]
180
- }]
181
- }
182
- }
183
- ```
184
-
185
- ### 2. Initialize Directory Structure
186
-
187
- The system creates directories automatically on first use, but you can also create them manually:
188
-
189
- ```bash
190
- # Global directories
191
- mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/ecc-homunculus"/{instincts/{personal,inherited},evolved/{agents,skills,commands},projects}
192
-
193
- # Project directories are auto-created when the hook first runs in a git repo
194
- ```
195
-
196
- ### 3. Use the Instinct Commands
197
-
198
- ```bash
199
- /instinct-status # Show learned instincts (project + global)
200
- /evolve # Cluster related instincts into skills/commands
201
- /instinct-export # Export instincts to file
202
- /instinct-import # Import instincts from others
203
- /promote # Promote project instincts to global scope
204
- /projects # List all known projects and their instinct counts
205
- ```
206
-
207
- ## Commands
208
-
209
- | Command | Description |
210
- |---------|-------------|
211
- | `/instinct-status` | Show all instincts (project-scoped + global) with confidence |
212
- | `/evolve` | Cluster related instincts into skills/commands, suggest promotions |
213
- | `/instinct-export` | Export instincts (filterable by scope/domain) |
214
- | `/instinct-import <file>` | Import instincts with scope control |
215
- | `/promote [id]` | Promote project instincts to global scope |
216
- | `/projects` | List all known projects and their instinct counts |
217
-
218
- ## Configuration
219
-
220
- Edit `config.json` to control the background observer:
221
-
222
- ```json
223
- {
224
- "version": "2.1",
225
- "observer": {
226
- "enabled": false,
227
- "run_interval_minutes": 5,
228
- "min_observations_to_analyze": 20
229
- }
230
- }
231
- ```
232
-
233
- | Key | Default | Description |
234
- |-----|---------|-------------|
235
- | `observer.enabled` | `false` | Enable the background observer agent |
236
- | `observer.run_interval_minutes` | `5` | How often the observer analyzes observations |
237
- | `observer.min_observations_to_analyze` | `20` | Minimum observations before analysis runs |
238
-
239
- Other behavior (observation capture, instinct thresholds, project scoping, promotion criteria) is configured via code defaults in `instinct-cli.py` and `observe.sh`.
240
-
241
- ## File Structure
242
-
243
- ```
244
- ${XDG_DATA_HOME:-~/.local/share}/ecc-homunculus/
245
- +-- identity.json # Your profile, technical level
246
- +-- projects.json # Registry: project hash -> name/path/remote
247
- +-- observations.jsonl # Global observations (fallback)
248
- +-- instincts/
249
- | +-- personal/ # Global auto-learned instincts
250
- | +-- inherited/ # Global imported instincts
251
- +-- evolved/
252
- | +-- agents/ # Global generated agents
253
- | +-- skills/ # Global generated skills
254
- | +-- commands/ # Global generated commands
255
- +-- projects/
256
- +-- a1b2c3d4e5f6/ # Project hash (from git remote URL)
257
- | +-- project.json # Per-project metadata mirror (id/name/root/remote)
258
- | +-- observations.jsonl
259
- | +-- observations.archive/
260
- | +-- instincts/
261
- | | +-- personal/ # Project-specific auto-learned
262
- | | +-- inherited/ # Project-specific imported
263
- | +-- evolved/
264
- | +-- skills/
265
- | +-- commands/
266
- | +-- agents/
267
- +-- f6e5d4c3b2a1/ # Another project
268
- +-- ...
269
- ```
270
-
271
- ## Scope Decision Guide
272
-
273
- | Pattern Type | Scope | Examples |
274
- |-------------|-------|---------|
275
- | Language/framework conventions | **project** | "Use React hooks", "Follow Django REST patterns" |
276
- | File structure preferences | **project** | "Tests in `__tests__`/", "Components in src/components/" |
277
- | Code style | **project** | "Use functional style", "Prefer dataclasses" |
278
- | Error handling strategies | **project** | "Use Result type for errors" |
279
- | Security practices | **global** | "Validate user input", "Sanitize SQL" |
280
- | General best practices | **global** | "Write tests first", "Always handle errors" |
281
- | Tool workflow preferences | **global** | "Grep before Edit", "Read before Write" |
282
- | Git practices | **global** | "Conventional commits", "Small focused commits" |
283
-
284
- ## Instinct Promotion (Project -> Global)
285
-
286
- When the same instinct appears in multiple projects with high confidence, it's a candidate for promotion to global scope.
287
-
288
- **Auto-promotion criteria:**
289
- - Same instinct ID in 2+ projects
290
- - Average confidence >= 0.8
291
-
292
- **How to promote:**
293
-
294
- ```bash
295
- # Promote a specific instinct
296
- python3 instinct-cli.py promote prefer-explicit-errors
297
-
298
- # Auto-promote all qualifying instincts
299
- python3 instinct-cli.py promote
300
-
301
- # Preview without changes
302
- python3 instinct-cli.py promote --dry-run
303
- ```
304
-
305
- The `/evolve` command also suggests promotion candidates.
306
-
307
- ## Confidence Scoring
308
-
309
- Confidence evolves over time:
310
-
311
- | Score | Meaning | Behavior |
312
- |-------|---------|----------|
313
- | 0.3 | Tentative | Suggested but not enforced |
314
- | 0.5 | Moderate | Applied when relevant |
315
- | 0.7 | Strong | Auto-approved for application |
316
- | 0.9 | Near-certain | Core behavior |
317
-
318
- **Confidence increases** when:
319
- - Pattern is repeatedly observed
320
- - User doesn't correct the suggested behavior
321
- - Similar instincts from other sources agree
322
-
323
- **Confidence decreases** when:
324
- - User explicitly corrects the behavior
325
- - Pattern isn't observed for extended periods
326
- - Contradicting evidence appears
327
-
328
- ## Why Hooks vs Skills for Observation?
329
-
330
- > "v1 relied on skills to observe. Skills are probabilistic -- they fire ~50-80% of the time based on Claude's judgment."
331
-
332
- Hooks fire **100% of the time**, deterministically. This means:
333
- - Every tool call is observed
334
- - No patterns are missed
335
- - Learning is comprehensive
336
-
337
- ## Backward Compatibility
338
-
339
- v2.1 is fully compatible with v2.0 and v1:
340
- - Existing global instincts can be migrated from `~/.claude/homunculus/instincts/` with `scripts/migrate-homunculus.sh`
341
- - Existing `~/.claude/skills/learned/` skills from v1 still work
342
- - Stop hook still runs (but now also feeds into v2)
343
- - Gradual migration: run both in parallel
344
-
345
- ## Privacy
346
-
347
- - Observations stay **local** on your machine
348
- - Project-scoped instincts are isolated per project
349
- - Only **instincts** (patterns) can be exported — not raw observations
350
- - No actual code or conversation content is shared
351
- - You control what gets exported and promoted
352
-
353
- ## Related
354
-
355
- - [ECC-Tools GitHub App](https://github.com/apps/ecc-tools) - Generate instincts from repo history
356
- - Homunculus - Community project that inspired the v2 instinct-based architecture (atomic observations, confidence scoring, instinct evolution pipeline)
357
- - [The Longform Guide](https://x.com/affaanmustafa/status/2014040193557471352) - Continuous learning section
358
-
359
- ---
360
-
361
- *Instinct-based learning: teaching Claude your patterns, one project at a time.*