oh-my-customcode 0.79.5 → 0.81.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.
@@ -0,0 +1,335 @@
1
+ ---
2
+ name: adaptive-harness
3
+ description: Auto-detect project context and optimize harness — deactivate unused agents/skills, suggest missing experts, generate project profile
4
+ scope: harness
5
+ version: 1.0.0
6
+ user-invocable: true
7
+ argument-hint: "[--optimize|--scan|--learn|--export|--import|--dry-run] [target-dir]"
8
+ effort: high
9
+ ---
10
+
11
+ # Adaptive Harness Self-Customization Skill
12
+
13
+ Automatically detects project context and optimizes the oh-my-customcode harness (agents, skills, rules) to fit the project. Generates a persistent project profile that drives agent activation decisions and records learned patterns over time.
14
+
15
+ ## Usage
16
+
17
+ ```
18
+ /omcustom:adaptive-harness # Full scan + optimize
19
+ /omcustom:adaptive-harness --scan # Scan only (generate/update project profile)
20
+ /omcustom:adaptive-harness --optimize # Deactivate unused, suggest missing
21
+ /omcustom:adaptive-harness --learn # Analyze failure patterns, update profile
22
+ /omcustom:adaptive-harness --export # Export profile as portable bundle
23
+ /omcustom:adaptive-harness --import <path> # Import profile from another project
24
+ /omcustom:adaptive-harness --dry-run # Show what would change without modifying
25
+ ```
26
+
27
+ Default (no flag): runs `--scan` then `--optimize` in sequence.
28
+
29
+ ## Project Profile Format
30
+
31
+ The skill generates and maintains `.claude/project-profile.yaml`. Manual edits to this file are preserved across runs — the skill merges new detections with existing content rather than overwriting.
32
+
33
+ ```yaml
34
+ # Auto-generated by adaptive-harness. Manual edits will be preserved.
35
+ project:
36
+ name: detected-project-name
37
+ scanned_at: "2026-04-12T10:00:00Z"
38
+
39
+ tech_stack:
40
+ languages: [python, typescript]
41
+ frameworks: [fastapi, next.js]
42
+ databases: [postgres, redis]
43
+ infra: [docker, aws]
44
+
45
+ detection_evidence:
46
+ - indicator: "requirements.txt found"
47
+ confidence: high
48
+ suggests: [lang-python-expert, be-fastapi-expert]
49
+ - indicator: "package.json with next dependency"
50
+ confidence: high
51
+ suggests: [lang-typescript-expert, fe-vercel-agent]
52
+
53
+ active_agents:
54
+ - lang-python-expert
55
+ - be-fastapi-expert
56
+ - lang-typescript-expert
57
+ - fe-vercel-agent
58
+ - db-postgres-expert
59
+ - db-redis-expert
60
+ - infra-docker-expert
61
+ - infra-aws-expert
62
+ # manager agents always active
63
+ - mgr-creator
64
+ - mgr-gitnerd
65
+ - mgr-sauron
66
+ - mgr-supplier
67
+ - mgr-updater
68
+ - mgr-claude-code-bible
69
+
70
+ inactive_agents:
71
+ - lang-golang-expert # no Go files detected
72
+ - lang-rust-expert # no Rust files detected
73
+
74
+ usage_stats:
75
+ most_used_agents: [] # populated by --learn
76
+ failure_patterns: [] # populated by --learn
77
+
78
+ overrides:
79
+ rules: {} # e.g., R009: { max_parallel: 5 }
80
+
81
+ last_optimized: "2026-04-12T10:00:00Z"
82
+ ```
83
+
84
+ ## Workflow: --scan
85
+
86
+ Scans the TARGET project (the project using oh-my-customcode, not the harness itself) and generates or updates the project profile. Uses Read, Glob, and Grep only — no side effects.
87
+
88
+ ### Step 1: Detect Tech Stack
89
+
90
+ Check for language manifest files and framework indicators:
91
+
92
+ | Indicator Files | Tech | Suggests Agents |
93
+ |----------------|------|-----------------|
94
+ | `go.mod`, `*.go` | Go | lang-golang-expert, be-go-backend-expert |
95
+ | `Cargo.toml`, `*.rs` | Rust | lang-rust-expert |
96
+ | `requirements.txt`, `pyproject.toml`, `*.py` | Python | lang-python-expert |
97
+ | `fastapi` in deps/imports | FastAPI | be-fastapi-expert |
98
+ | `django` in deps/imports | Django | be-django-expert |
99
+ | `package.json`, `tsconfig.json`, `*.ts`, `*.tsx` | TypeScript | lang-typescript-expert |
100
+ | `next` in package.json deps | Next.js | fe-vercel-agent |
101
+ | `vue` in package.json deps | Vue.js | fe-vuejs-agent |
102
+ | `svelte.config.*`, `*.svelte` | Svelte | fe-svelte-agent |
103
+ | `pubspec.yaml`, `*.dart` | Flutter | fe-flutter-agent |
104
+ | `*.kt`, `build.gradle.kts` | Kotlin | lang-kotlin-expert |
105
+ | `*.java`, `pom.xml` | Java | lang-java21-expert |
106
+ | `spring-boot` in deps | Spring Boot | be-springboot-expert |
107
+ | `express` in package.json deps | Express | be-express-expert |
108
+ | `@nestjs` in package.json deps | NestJS | be-nestjs-expert |
109
+ | `Dockerfile`, `docker-compose.*` | Docker | infra-docker-expert |
110
+ | `cdk.json`, `template.yaml`, `.aws/` | AWS | infra-aws-expert |
111
+ | `terraform/`, `*.tf` | Terraform | infra-aws-expert |
112
+ | `.github/workflows/` | CI/CD | mgr-gitnerd |
113
+ | `*.sql`, `alembic/`, `pg` in deps | PostgreSQL | db-postgres-expert |
114
+ | `redis` in deps/config | Redis | db-redis-expert |
115
+ | `supabase` in deps/config | Supabase | db-supabase-expert |
116
+ | `prisma/`, `drizzle/` | ORM | db-postgres-expert |
117
+ | `dags/*.py`, `airflow` in deps | Airflow | de-airflow-expert |
118
+ | `dbt_project.yml` | dbt | de-dbt-expert |
119
+ | `kafka` in deps/config | Kafka | de-kafka-expert |
120
+ | `spark` in deps/config | Spark | de-spark-expert |
121
+ | `snowflake` in deps/config | Snowflake | de-snowflake-expert |
122
+
123
+ ### Step 2: Build Detection Evidence
124
+
125
+ For each indicator found, record:
126
+ - `indicator`: human-readable description of what was found
127
+ - `confidence`: `high` (direct manifest file) | `medium` (dependency reference) | `low` (indirect signal)
128
+ - `suggests`: list of agent names this indicator implies
129
+
130
+ ### Step 3: Write Project Profile
131
+
132
+ Delegate write to a subagent (R010). Merge with existing profile if present — preserve `overrides`, `usage_stats`, and any manual entries.
133
+
134
+ Output format:
135
+
136
+ ```
137
+ [adaptive-harness --scan] Target: /path/to/project
138
+
139
+ Tech Stack Detected:
140
+ - Python (requirements.txt + pyproject.toml found) [confidence: high]
141
+ - FastAPI ("fastapi" in requirements.txt) [confidence: high]
142
+ - TypeScript (tsconfig.json found) [confidence: high]
143
+ - Next.js ("next" in package.json deps) [confidence: high]
144
+ - Docker (Dockerfile found) [confidence: high]
145
+ - PostgreSQL ("psycopg2" in requirements.txt) [confidence: medium]
146
+ - Redis ("redis" in requirements.txt) [confidence: medium]
147
+ - AWS (cdk.json found) [confidence: high]
148
+
149
+ Active agents identified: 8
150
+ Profile written: .claude/project-profile.yaml
151
+ ```
152
+
153
+ ## Workflow: --optimize
154
+
155
+ Reads the project profile and adjusts which agent files are active.
156
+
157
+ ### Step 1: Load Profile
158
+
159
+ Read `.claude/project-profile.yaml`. If the profile does not exist, run `--scan` first.
160
+
161
+ ### Step 2: Identify Inactive Agents
162
+
163
+ Compare all agent files in `.claude/agents/*.md` against `active_agents` list from the profile. Agents not in the active list (and not in the always-active set below) are candidates for deactivation.
164
+
165
+ ### Always-Active Agents (never deactivate)
166
+
167
+ ```
168
+ mgr-creator, mgr-gitnerd, mgr-sauron, mgr-supplier, mgr-updater, mgr-claude-code-bible
169
+ sys-memory-keeper, sys-naggy
170
+ arch-documenter, arch-speckit-agent
171
+ ```
172
+
173
+ ### Step 3: Move Inactive Agents
174
+
175
+ Delegate to subagent (R010):
176
+ - Create `.claude/agents/.inactive/` directory if it does not exist
177
+ - Move inactive agent `.md` files to `.claude/agents/.inactive/`
178
+ - Update `inactive_agents` list in project profile
179
+
180
+ ### Step 4: Detect Gaps
181
+
182
+ Check `active_agents` list against files actually present in `.claude/agents/`. If an active agent file is missing, flag it as a gap and suggest `mgr-creator` to fill it.
183
+
184
+ ### Step 5: Log Adaptations
185
+
186
+ Append a record to `.claude/outputs/harness-adaptations/YYYY-MM-DD.md`:
187
+
188
+ ```markdown
189
+ ## Optimization Run — 2026-04-12T10:00:00Z
190
+
191
+ Deactivated (moved to .inactive/):
192
+ - lang-golang-expert
193
+ - lang-rust-expert
194
+ - de-airflow-expert
195
+
196
+ Gaps detected (agents needed but missing):
197
+ - (none)
198
+
199
+ Profile: .claude/project-profile.yaml
200
+ ```
201
+
202
+ ### Restore
203
+
204
+ Run `--optimize --restore` to move all files from `.claude/agents/.inactive/` back to `.claude/agents/`. This reverses the last optimization.
205
+
206
+ Output format:
207
+
208
+ ```
209
+ [adaptive-harness --optimize]
210
+
211
+ Always-active agents: 10 (protected)
212
+ Active per profile: 8
213
+ Candidates for deactivation: 29
214
+
215
+ Deactivated:
216
+ - lang-golang-expert → .claude/agents/.inactive/
217
+ - lang-rust-expert → .claude/agents/.inactive/
218
+ - de-airflow-expert → .claude/agents/.inactive/
219
+ ... (26 more)
220
+
221
+ Gaps detected: 0
222
+
223
+ Log: .claude/outputs/harness-adaptations/2026-04-12.md
224
+ Summary: 29 deactivated, 18 active, 0 gaps
225
+ ```
226
+
227
+ **--dry-run** mode outputs `[would deactivate]` / `[would restore]` without moving any files.
228
+
229
+ ## Workflow: --learn
230
+
231
+ Analyzes session history and eval-core data to populate `usage_stats` and `failure_patterns` in the project profile.
232
+
233
+ ### Step 1: Collect Data Sources
234
+
235
+ - `.claude/outputs/` — session artifacts and eval results
236
+ - `.claude/agent-memory/` — agent memory files with usage patterns
237
+ - Any harness eval output from `/omcustom:harness-eval`
238
+
239
+ ### Step 2: Extract Patterns
240
+
241
+ ```
242
+ Most-used agents: Count agent invocations across outputs
243
+ Failure patterns: Identify agents that frequently retried or errored
244
+ Unused agents: Active agents with zero invocations in recent N sessions
245
+ ```
246
+
247
+ ### Step 3: Update Profile
248
+
249
+ Merge findings into `usage_stats` and `failure_patterns` sections of the project profile. Preserve existing entries; append new ones.
250
+
251
+ ### Step 4: Generate Suggestions
252
+
253
+ Based on failure patterns, suggest:
254
+ - Rule overrides (e.g., increase `max_parallel` if timeout patterns detected)
255
+ - Agent replacements (e.g., suggest escalation to `opus` model for frequently failing tasks)
256
+ - Additional skills that may reduce failure rate
257
+
258
+ Output format:
259
+
260
+ ```
261
+ [adaptive-harness --learn]
262
+
263
+ Sessions analyzed: 12
264
+ Agent invocations found: 847
265
+
266
+ Most-used agents (top 5):
267
+ 1. lang-python-expert (312 invocations)
268
+ 2. be-fastapi-expert (189 invocations)
269
+ 3. mgr-gitnerd (97 invocations)
270
+ 4. db-postgres-expert (84 invocations)
271
+ 5. lang-typescript-expert (71 invocations)
272
+
273
+ Failure patterns:
274
+ - db-postgres-expert: 3 retries in session 2026-04-10 (timeout pattern)
275
+
276
+ Suggestions:
277
+ - db-postgres-expert: consider effort: high for complex query generation
278
+ - de-kafka-expert: 0 invocations — candidate for deactivation
279
+
280
+ Profile updated: .claude/project-profile.yaml
281
+ ```
282
+
283
+ ## Workflow: --export / --import
284
+
285
+ ### Export
286
+
287
+ Bundles the project profile and active agent list for sharing with another project or team member.
288
+
289
+ Output: `.claude/outputs/harness-bundle-YYYY-MM-DD.json`
290
+
291
+ ```json
292
+ {
293
+ "version": "1.0.0",
294
+ "exported_at": "2026-04-12T10:00:00Z",
295
+ "source_project": "detected-project-name",
296
+ "profile": { ... },
297
+ "active_agent_names": [ ... ]
298
+ }
299
+ ```
300
+
301
+ ### Import
302
+
303
+ ```
304
+ /omcustom:adaptive-harness --import .claude/outputs/harness-bundle-2026-04-12.json
305
+ ```
306
+
307
+ Reads the bundle and applies the `active_agents` list to the current project by running `--optimize` with the imported profile. Does not overwrite `usage_stats` or `failure_patterns` from the current project.
308
+
309
+ ## Execution Rules
310
+
311
+ - `--scan` uses Read, Glob, Grep only — no writes, safe to run anytime
312
+ - All file writes (profile, logs, agent moves) are delegated to subagents (R010)
313
+ - `--dry-run` suppresses all writes; outputs `[would ...]` for every action
314
+ - Profile changes are always logged to `.claude/outputs/harness-adaptations/` for auditability
315
+ - When profile already exists, the skill merges new detections rather than overwriting
316
+ - Parallel Glob/Grep calls are used during `--scan` for performance (R009)
317
+
318
+ ## Integration
319
+
320
+ | Component | Interaction |
321
+ |-----------|-------------|
322
+ | `/omcustom:analysis` | Calls adaptive-harness `--scan` after initial tech stack detection to persist the profile |
323
+ | `SessionStart` hook | Lightweight profile existence check only — no full scan at startup |
324
+ | `mgr-creator` | Invoked when gaps are detected during `--optimize` to create missing agent files |
325
+ | `R016` (Continuous Improvement) | Failure patterns from `--learn` may trigger rule updates |
326
+ | `eval-core` | Primary data source for `--learn` invocation and usage pattern extraction |
327
+ | `mgr-sauron` | Run after `--optimize` to verify structural integrity (R017) |
328
+
329
+ ## Notes
330
+
331
+ - Always run `--dry-run` first on a new project to preview deactivation scope
332
+ - `--optimize --restore` is the safe exit if deactivation causes unexpected routing failures
333
+ - The `.inactive/` directory is git-tracked so deactivation decisions are visible in history
334
+ - Manager and system agents are unconditionally protected from deactivation
335
+ - Target directory defaults to the project root where Claude Code is running, not the omcustom harness directory
@@ -187,6 +187,25 @@ Detection Details:
187
187
  no Cargo.toml found → Rust skipped
188
188
  ```
189
189
 
190
+ ### Step 5: Adaptive Harness Integration
191
+
192
+ After analysis completes, offer adaptive-harness optimization:
193
+
194
+ ```
195
+ [Analysis Complete] Tech stack detected. Optimize harness for this project?
196
+ ├── Yes → Run /omcustom:adaptive-harness --optimize (deactivate unused, suggest missing)
197
+ ├── Dry-run → Run /omcustom:adaptive-harness --optimize --dry-run (show changes only)
198
+ └── Skip → Keep current harness configuration
199
+ ```
200
+
201
+ If user selects Yes or Dry-run, invoke the adaptive-harness skill with the analysis results as context. The project profile generated by analysis feeds directly into adaptive-harness optimization.
202
+
203
+ ## Integration
204
+
205
+ | Skill | Integration |
206
+ |-------|-------------|
207
+ | adaptive-harness | Called after analysis to optimize harness based on detected stack |
208
+
190
209
  ## Example Invocation
191
210
 
192
211
  ```