@ainova-systems/intelligence 0.11.0-rc.7 → 0.11.0-rc.9

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 (51) hide show
  1. package/README.md +19 -16
  2. package/cli/commands/adapter.sh +153 -0
  3. package/cli/commands/init.sh +113 -22
  4. package/cli/commands/package.sh +30 -0
  5. package/cli/commands/registry.sh +4 -2
  6. package/cli/commands/status.sh +12 -4
  7. package/cli/commands/sync.sh +7 -20
  8. package/cli/commands/update.sh +76 -70
  9. package/cli/engine-package.yaml +2 -2
  10. package/cli/intelligence +10 -12
  11. package/cli/{commands/doctor.sh → internal/check.sh} +30 -23
  12. package/cli/{commands/migrate.sh → internal/migrate-v1.sh} +117 -30
  13. package/cli/{commands/add.sh → internal/package-add.sh} +11 -16
  14. package/cli/{commands/list.sh → internal/package-list.sh} +9 -4
  15. package/cli/{commands/remove.sh → internal/package-remove.sh} +3 -3
  16. package/cli/{commands/search.sh → internal/package-search.sh} +4 -4
  17. package/cli/internal/package-update.sh +103 -0
  18. package/cli/{commands/install.sh → internal/restore.sh} +7 -18
  19. package/cli/internal/target-state.sh +57 -0
  20. package/cli/internal/upgrade-v2.sh +133 -0
  21. package/cli/lib/cli-common.sh +142 -12
  22. package/cli/lib/lockfile.sh +1 -1
  23. package/cli/lib/manifest.sh +109 -0
  24. package/cli/lib/registry.sh +4 -4
  25. package/engine/ENGINE_SHA +1 -1
  26. package/engine/adapters/_template.sh +10 -9
  27. package/engine/adapters/agents.sh +11 -11
  28. package/engine/adapters/opencode.sh +1 -1
  29. package/engine/lib/common.sh +14 -22
  30. package/engine/lib/contract.sh +14 -14
  31. package/engine/sync.sh +25 -20
  32. package/package.json +1 -1
  33. package/packages/sync/agents/intelligence-architect.md +5 -3
  34. package/packages/sync/agents/intelligence-operator.md +10 -13
  35. package/packages/sync/references/adapters.md +252 -0
  36. package/packages/sync/references/conventions.md +385 -0
  37. package/packages/sync/rules/intelligence-authoring.md +6 -6
  38. package/packages/sync/skills/intelligence-add-agent/SKILL.md +5 -5
  39. package/packages/sync/skills/intelligence-add-rule/SKILL.md +3 -3
  40. package/packages/sync/skills/intelligence-add-skill/SKILL.md +3 -3
  41. package/packages/sync/skills/intelligence-extract-skill/SKILL.md +2 -2
  42. package/packages/sync/skills/intelligence-install-adapter/SKILL.md +29 -22
  43. package/packages/sync/skills/intelligence-learn-from-context/SKILL.md +3 -3
  44. package/packages/sync/skills/intelligence-learn-from-repository/SKILL.md +55 -0
  45. package/packages/sync/skills/intelligence-review-skills/SKILL.md +6 -6
  46. package/packages/sync/skills/intelligence-sync/SKILL.md +13 -9
  47. package/packages/sync/skills/intelligence-uninstall-adapter/SKILL.md +19 -37
  48. package/packages/sync/skills/intelligence-update/SKILL.md +34 -156
  49. package/cli/commands/upgrade.sh +0 -68
  50. package/packages/sync/docs/ADAPTERS.md +0 -214
  51. package/packages/sync/docs/CONVENTIONS.md +0 -456
@@ -0,0 +1,385 @@
1
+ # Intelligence Authoring Conventions
2
+
3
+ Intelligence stores project-owned AI rules, agents and skills as tool-neutral Markdown. The CLI installs shared packages, and the sync engine renders each enabled target's native files.
4
+
5
+ ## Choose the right artifact
6
+
7
+ | Type | Intent | Loading | Content |
8
+ |---|---|---|---|
9
+ | **Rule** | The model respects a constraint or convention | Automatic: always-on or path-scoped | Required patterns, invariants, architecture and examples |
10
+ | **Skill** | The model performs a procedure | Explicit invocation | Ordered steps, decisions and verification |
11
+ | **Agent** | The model adopts a role or expertise boundary | Explicit selection or skill binding | Expertise, boundaries and build/verify behavior |
12
+
13
+ Use these tests:
14
+
15
+ - “The model should consider this during every task in scope” → rule.
16
+ - “The model should execute these steps” → skill.
17
+ - “The model should reason as this specialist” → agent.
18
+
19
+ Do not bury conventions in agents, workflows in rules or reusable expertise in skills. Each misplaced concern either fails to load when needed or consumes context when it is not needed.
20
+
21
+ ## v2 project structure
22
+
23
+ ```text
24
+ project/
25
+ ├── intelligence.yaml # root manifest and schema_version contract
26
+ ├── intelligence.lock # resolved packages; commit it
27
+ ├── intelligence/ # project-owned content; name is configurable
28
+ │ ├── rules/
29
+ │ │ ├── context.md
30
+ │ │ └── backend.md
31
+ │ ├── agents/
32
+ │ │ └── backend-developer.md
33
+ │ ├── skills/
34
+ │ │ └── backend-add-endpoint/
35
+ │ │ └── SKILL.md
36
+ │ └── adapters/ # optional project adapters
37
+ │ └── mytool.sh
38
+ ├── .intelligence/ # CLI-managed package store; gitignored
39
+ │ └── packages/
40
+ │ └── @scope/name/
41
+ ├── AGENTS.md # generated canonical context; normally committed
42
+ └── .claude/ .cursor/ ... # generated tool-native output
43
+ ```
44
+
45
+ The content directory defaults to `intelligence/`. A project may set `project.intelligence_dir` in `intelligence.yaml`; never infer or hardcode the default when the manifest is available.
46
+
47
+ Project-authored rules, agents, skills and adapters live in the content directory. Installed package content lives under `.intelligence/packages/` and is replaced by CLI lifecycle/package operations; edit it only in its source repository. The executable engine remains with the installed CLI, outside the project.
48
+
49
+ The `intelligence-` name prefix is reserved for artifacts shipped by `@ainova-systems/sync`. Project artifacts use their project or domain prefix.
50
+
51
+ ## Manifest, packages and sources
52
+
53
+ The engine consumes ordinary local source paths:
54
+
55
+ ```yaml
56
+ project:
57
+ name: payments
58
+ intelligence_dir: "intelligence" # optional; this is the default
59
+
60
+ schema_version: "0.11.0"
61
+
62
+ sources:
63
+ rules:
64
+ - ".intelligence/packages/@ainova-systems/sync/rules"
65
+ - "intelligence/rules"
66
+ agents:
67
+ - ".intelligence/packages/@ainova-systems/sync/agents"
68
+ - "intelligence/agents"
69
+ skills:
70
+ - ".intelligence/packages/@ainova-systems/sync/skills"
71
+ - "intelligence/skills"
72
+ ```
73
+
74
+ Missing project-owned source directories are skipped, so a package-only project need not create empty `rules/`, `agents/` or `skills/` directories. Source order matters: later files with the same artifact name overwrite earlier ones. Package sources are wired before project sources so the project can override a package artifact deliberately.
75
+
76
+ The CLI owns package and registry blocks:
77
+
78
+ ```yaml
79
+ packages:
80
+ "@acme/backend":
81
+ version: "^1.2.0"
82
+
83
+ registries:
84
+ - "https://github.com/acme/intelligence-registry.git"
85
+ ```
86
+
87
+ Do not put Git URLs or remote tokens directly in `sources:`. Use:
88
+
89
+ ```bash
90
+ intelligence package add @acme/backend
91
+ intelligence package add github:acme/backend-intelligence
92
+ intelligence package add 'git+https://git.example.com/acme/backend.git@main#package'
93
+ ```
94
+
95
+ Registries are an ordered trust list and the only resolver for a package name. There is no built-in catalog and no `@org/name` → GitHub guessing. An explicit `github:` or `git+` spec bypasses registry lookup. In every case the manifest stores only requested `version` or `ref`; resolved URL/path and SHA live in the lock.
96
+
97
+ Stable Git tags provide package versions. Semver ranges select the highest matching stable tag; a `ref:` pin names a branch or commit and does not move during `intelligence update`. One package name has one version per project.
98
+
99
+ Commit `intelligence.lock`. It records requested versions, source URLs and paths, resolved refs and commit SHAs. After cloning, `intelligence sync` restores a missing store strictly from that lock before rendering; manifest/lock or SHA drift is refused. Re-run `package add` when deliberately changing a source.
100
+
101
+ `@ainova-systems/sync` is ordinary package content exact-pinned to the bundled engine version. `intelligence init` installs it unless `--bare` is used. Lifecycle preflight keeps that pin and `schema_version` aligned with the installed CLI; package-range updates never move it independently.
102
+
103
+ ## Layout tokens
104
+
105
+ Package-owned artifacts cannot assume the project's content-directory name or their installed package path. They use tokens expanded by every adapter through `finalize_output_file`:
106
+
107
+ | Token | v2 expansion |
108
+ |---|---|
109
+ | `<content-dir>` | Repo-relative content directory, usually `intelligence` |
110
+ | `<module>` | Installed sync package, usually `.intelligence/packages/@ainova-systems/sync` |
111
+ | `<manifest>` | `intelligence.yaml` |
112
+ | `<sync-cmd>` | `intelligence sync` |
113
+
114
+ Expansion applies to frontmatter and bodies. Thus `paths: ["<content-dir>/**"]` reaches every native scoped-rule format with the project's real directory name.
115
+
116
+ Project-authored artifacts normally use their known project paths directly. Tokens are useful only when the same artifact must work under different content-directory or package-store locations.
117
+
118
+ ## Naming
119
+
120
+ Rule filenames, agent names and skill names share a domain prefix such as `backend-`, `frontend-`, `devops-`, `core-`, `tests-`, a project codename or a monorepo component. Pick the domain from repository structure and reuse it.
121
+
122
+ - Skills: `<domain>-<verb>-<noun>`, for example `backend-add-endpoint`.
123
+ - Agents: `<domain>-<role>`, for example `backend-code-reviewer`.
124
+ - Rules: `<domain>.md`, for example `backend.md`.
125
+
126
+ Common skill verbs:
127
+
128
+ | Verb | Meaning |
129
+ |---|---|
130
+ | `add-` | Add one member to an existing set |
131
+ | `create-` | Create a new container or top-level artifact |
132
+ | `update-` | Revise existing state selectively |
133
+ | `run-` | Execute an operation |
134
+ | `review-` | Perform read-only analysis |
135
+ | `test-` | Verify behavior |
136
+ | `remove-` | Remove an artifact safely |
137
+
138
+ The verb describes the outcome, not whether the skill implements the work or delegates to another command or skill.
139
+
140
+ ## Agent conventions
141
+
142
+ ```yaml
143
+ ---
144
+ name: backend-developer
145
+ description: "Implements backend features"
146
+ tier: heavy
147
+ access: full
148
+ skills:
149
+ - backend-add-endpoint
150
+ ---
151
+
152
+ # Backend developer
153
+
154
+ Agent instructions in Markdown.
155
+ ```
156
+
157
+ An agent stays thin: **Expertise** → **Boundaries** → **Build & Verify**. Its role, limits and proof of completion belong here; reusable constraints belong in rules and reusable procedures belong in skills.
158
+
159
+ Do not instruct an agent to read rules or restate their content. Claude loads its generated rules for its subagents, while Cursor, Copilot, Codex, Pi and OpenCode receive always-on rules through `AGENTS.md`. Duplicating a rule in an agent spends context twice and creates a copy that drifts.
160
+
161
+ ### Tier mappings
162
+
163
+ | Tier | Claude | Cursor | Copilot / Codex | OpenCode | Typical use |
164
+ |---|---|---|---|---|---|
165
+ | `heavy` | `opus` | `inherit` | `gpt-5.6-sol` | `anthropic/claude-opus-4-8` | implementation, complex reasoning, migration |
166
+ | `standard` | `sonnet` | `inherit` | `gpt-5.6-terra` | `anthropic/claude-sonnet-5` | review, validation, analysis |
167
+ | `light` | `haiku` | `fast` | `gpt-5.6-luna` | `anthropic/claude-haiku-4-5-20251001` | lookups and simple formatting |
168
+
169
+ The vocabulary is tool-neutral. Adapters resolve it through `get_model()`. Override a default under `models.<tool>.<tier>` in `intelligence.yaml` only when the project needs a pin; sync reports drift when that override differs from the current default.
170
+
171
+ ### Access mappings
172
+
173
+ `access: full` inherits ordinary tool permissions. `access: readonly` is transformed into the target's native restriction: for example Claude receives read/search/bash tools with writes disallowed, Cursor receives `readonly: true`, and Codex receives a read-only sandbox.
174
+
175
+ Use only `full` or `readonly` in source agents. Tool-specific permission syntax belongs in adapters.
176
+
177
+ ## Rule conventions
178
+
179
+ ```yaml
180
+ ---
181
+ paths:
182
+ - "src/backend/**"
183
+ - "config/**"
184
+ description: "Backend conventions"
185
+ ---
186
+
187
+ # Backend conventions
188
+
189
+ Rule content in Markdown.
190
+ ```
191
+
192
+ `paths:` is optional:
193
+
194
+ - With `paths:`, the rule is scoped to matching repository files.
195
+ - Without `paths:`, the rule is always-on project context.
196
+
197
+ ### Routing
198
+
199
+ | Source rule | Claude | Cursor | Copilot | Codex / Pi / OpenCode / `AGENTS.md` |
200
+ |---|---|---|---|---|
201
+ | Scoped | copied with `paths:` | `.mdc` with `globs:` | `.instructions.md` with `applyTo:` | listed in `AGENTS.md`; Pi also gets on-demand files and an extension |
202
+ | Always-on | copied | omitted | omitted | inlined once into `AGENTS.md` |
203
+
204
+ Cursor, Copilot, Codex, Pi and OpenCode consume `AGENTS.md`, so always-on rules are not duplicated in their tool-specific channels. Claude does not consume `AGENTS.md`, so it receives the full rule set. OpenCode and Codex have no generated path-scoped rule channel; OpenCode users may configure `instructions:` globs themselves.
205
+
206
+ Keep always-on rules small. Put narrow framework or component guidance behind `paths:` so unrelated tasks do not pay its context cost.
207
+
208
+ ## Skill conventions
209
+
210
+ Skills follow the [Agent Skills standard](https://agentskills.io). Required fields are `name` and `description`.
211
+
212
+ ```yaml
213
+ ---
214
+ name: backend-add-endpoint
215
+ description: "Add a backend endpoint"
216
+ argument-hint: "<route-name>"
217
+ ---
218
+
219
+ # Add a backend endpoint
220
+
221
+ 1. Inspect the existing route pattern.
222
+ 2. Implement the endpoint.
223
+ 3. Run focused tests.
224
+ 4. Report the changed route and verification.
225
+ ```
226
+
227
+ Standard optional fields (`license`, `compatibility`, `metadata`, `allowed-tools`) and tool extensions pass through unchanged. A tool ignores fields it does not understand.
228
+
229
+ These limits reject a skill instead of degrading it:
230
+
231
+ | Field | Limit | Failure mode |
232
+ |---|---|---|
233
+ | `name` | 64 characters | Rejected at load |
234
+ | `description` | 1024 characters | Rejected at load |
235
+ | `argument-hint` | Must be a string | An unquoted `[value]` is parsed as a YAML sequence |
236
+
237
+ Sync quotes free-text `description` and `argument-hint` values in generated copies. `lint_frontmatter` warns when a name or description exceeds its hard limit, but the author must shorten it.
238
+
239
+ ### Description budget
240
+
241
+ Descriptions share the tool's available-artifact context budget.
242
+
243
+ | Case | Format | Target |
244
+ |---|---|---|
245
+ | Unique skill | Plain verb–noun phrase | 4–8 words |
246
+ | Similar sibling skills | Verb–noun plus a distinguishing trigger | 10–20 words, roughly 250 characters or less |
247
+
248
+ The 1024-character limit is a rejection wall, not a writing target. Curate duplicate and orphaned artifacts before compressing every description into ambiguity.
249
+
250
+ ### Skill body and resources
251
+
252
+ A skill that performs work carries the decisions and verification needed for that work. A skill that dispatches to deterministic CLI behavior stays thin: it chooses the command, interprets status and adds only judgment that the program cannot provide.
253
+
254
+ Keep on-demand detail beside the skill:
255
+
256
+ ```text
257
+ skill-name/
258
+ ├── SKILL.md
259
+ ├── references/ # detailed material loaded only when needed
260
+ ├── scripts/ # deterministic or repetitive helpers
261
+ └── assets/ # templates and output resources
262
+ ```
263
+
264
+ The engine copies the complete skill directory. Promote a helper outside the skill only when multiple skills share it.
265
+
266
+ Size limits are backstops, not quotas:
267
+
268
+ | Artifact | Hard cap | Response |
269
+ |---|---|---|
270
+ | `SKILL.md` body | 1000 lines | Move detail to `references/` |
271
+ | Reference file | 500 lines | Add a contents list past 300; split if still oversized |
272
+ | Rule | 500 lines | Split by scope or move examples behind a skill reference |
273
+ | Agent | 200 lines | Move procedures and constraints into skills/rules |
274
+
275
+ ## Writing discipline
276
+
277
+ - Use imperative form: “Read the manifest,” not “You should read the manifest.”
278
+ - Explain why a decision rule exists so the model can apply it to adjacent cases.
279
+ - Reserve absolute language for genuine safety, security and output-format invariants.
280
+ - Lead with the positive behavior; keep anti-patterns after the actionable guidance.
281
+ - Remove instructions that repeat tool defaults, repository facts already discoverable from files, or another artifact.
282
+ - Turn repeated deterministic work into a script or CLI command and let the skill interpret it.
283
+
284
+ Every line enters a finite context budget. Prefer subtraction, consolidation and precise scope over exhaustive prose.
285
+
286
+ ## Generated output
287
+
288
+ | Target | Rules | Skills | Agents |
289
+ |---|---|---|---|
290
+ | `agents` | Always-on inlined; scoped listed in `AGENTS.md` | Listed | Listed |
291
+ | Claude | `.claude/rules/` | `.claude/skills/` | `.claude/agents/` |
292
+ | Cursor | scoped `.cursor/rules/*.mdc` | `.cursor/skills/` | `.cursor/agents/` |
293
+ | Copilot | scoped `.github/instructions/*.instructions.md` | `.github/skills/` | `.github/agents/` |
294
+ | Codex | `AGENTS.md` only | `.agents/skills/` | `.codex/agents/*.toml` |
295
+ | Pi | `AGENTS.md` plus scoped `.pi/intelligence-sync/rules/` | `.agents/skills/` | `.pi/prompts/intelligence-agent-*.md` |
296
+ | OpenCode | `AGENTS.md` only | `.agents/skills/` plus slash commands | `.opencode/agents/*.md` |
297
+
298
+ `AGENTS.md` is regenerated by the `agents` adapter. Its optional static header is `targets.agents.header` in `intelligence.yaml`; generated rule, agent and skill sections follow it. Commit `AGENTS.md` when it is the project's shared canonical context.
299
+
300
+ Generated IDE output may be gitignored when every collaborator can reproduce it with `intelligence sync`. Use narrow ownership patterns so hand-authored tool settings remain trackable:
301
+
302
+ ```gitignore
303
+ # CLI-managed package store
304
+ .intelligence/
305
+
306
+ # Generated Claude and Cursor content; settings remain trackable
307
+ .claude/rules/
308
+ .claude/agents/
309
+ .claude/skills/
310
+ .cursor/rules/
311
+ .cursor/agents/
312
+ .cursor/skills/
313
+
314
+ # Generated open-standard and Codex content
315
+ .agents/
316
+ .codex/agents/
317
+
318
+ # Generated Pi content
319
+ .pi/intelligence-sync/
320
+ .pi/extensions/intelligence-sync-rules.ts
321
+ .pi/prompts/intelligence-agent-*.md
322
+
323
+ # Generated OpenCode agents. Its commands directory may also contain
324
+ # hand-authored files, so choose per-project ignores there.
325
+ .opencode/agents/
326
+ ```
327
+
328
+ Copilot output lives under `.github/`; choose whether to commit it with other repository-level GitHub configuration. Do not ignore `.github/` wholesale.
329
+
330
+ ## Project-owned adapters
331
+
332
+ Create a project adapter with:
333
+
334
+ ```bash
335
+ intelligence adapter create mytool
336
+ # implement <content-dir>/adapters/mytool.sh
337
+ intelligence adapter enable mytool
338
+ ```
339
+
340
+ Project adapters survive CLI upgrades and may override a built-in by name. `intelligence adapter enable mytool` runs a full sync so shared context stays current. `intelligence adapter disable mytool` keeps generated output for explicit, adapter-aware cleanup; a disabled project adapter can then be deleted with `intelligence adapter remove mytool`. See `adapters.md` for the function, ownership and safety contracts.
341
+
342
+ ## Schema and command boundaries
343
+
344
+ The permanent applied-schema key is the top-level scalar `schema_version` in `intelligence.yaml`. It is not a dotfile and not the CLI package version. Do not rename, move or reshape this key: every engine must be able to decide compatibility before parsing the rest of the manifest.
345
+
346
+ The public lifecycle is deliberately compact:
347
+
348
+ - `intelligence init [--preview|--apply]` is universal: it creates a new setup, aligns an existing v2 project, or plans/applies conversion of an eligible v1 project.
349
+ - `intelligence sync [adapter]` first aligns an existing v2 project with the installed CLI, restores a missing store strictly from `intelligence.lock`, then renders. In CI it refuses an upgrade that would change tracked files and points to a local `intelligence init --apply` plus review/commit.
350
+ - `intelligence update [@scope/name] [--preview|--apply]` is the only update surface. It prints the CLI/project/package plan; default mode prompts, `--preview` never writes, and `--apply` does not prompt. It never moves `ref:` pins.
351
+ - `intelligence package add|remove|list|search` owns package inventory.
352
+ - `intelligence adapter list|create|enable|disable|remove` owns adapter inventory and target state.
353
+ - `intelligence status [--check]` reports state; `--check` runs deep consistency checks.
354
+
355
+ Implement v2 schema changes as idempotent structural checks. Stage and verify replacement state before deleting or replacing prior state. A stale engine refuses a manifest whose `schema_version` is newer; normal v2 entry points close a behind-project gap through lifecycle preflight.
356
+
357
+ Breaking changelog entries use a `### Breaking` checklist of verifiable post-conditions. The update skill reads every release across the version gap, chooses the package/CLI/project command sequence and verifies those conditions after the deterministic command completes.
358
+
359
+ ### Engine status contract
360
+
361
+ The engine emits one machine-readable line, `IS_STATUS=<code> [IS_DETAIL=...]`, and exits with a stable code:
362
+
363
+ | `IS_STATUS` | Exit | Meaning |
364
+ |---|---:|---|
365
+ | `ok` | 0 | Sync or operation completed |
366
+ | `migrated` | 0 | Initialization converted an older layout |
367
+ | `error` | 1 | Generic failure |
368
+ | `config-missing` | 2 | Required manifest is absent |
369
+ | `ambiguous` | 3 | Conflicting state requiring agent/human judgment; reserved |
370
+ | `ahead-of-engine` | 4 | Manifest schema is newer than the engine |
371
+ | `aborted-incomplete` | 5 | Staged replacement was incomplete; prior state remains |
372
+ | `needs-update` | 6 | Project schema is behind the engine; rerun through a public lifecycle command |
373
+
374
+ Callers capture the real code with `command || rc=$?`. Do not use `if ! command; then rc=$?`; inside that branch `$?` is the status of the negation.
375
+
376
+ ## Project entry points
377
+
378
+ | Path | Role | Git status |
379
+ |---|---|---|
380
+ | `intelligence.yaml` | Manifest and schema contract | Tracked |
381
+ | `intelligence.lock` | Resolved package state | Tracked |
382
+ | `<content-dir>/{rules,agents,skills,adapters}/` | Project source of truth | Tracked |
383
+ | `.intelligence/` | Restorable package store | Ignored |
384
+ | `AGENTS.md` | Generated canonical project context | Normally tracked |
385
+ | Tool output directories | Generated native content | Project policy; use narrow ignores |
@@ -2,12 +2,12 @@
2
2
  name: intelligence-authoring
3
3
  description: "Authoring discipline for the intelligence layer - subtraction first, rule vs skill vs agent, scoping, size"
4
4
  paths:
5
- - "<umbrella>/**"
5
+ - "<content-dir>/**"
6
6
  ---
7
7
 
8
8
  # Authoring the intelligence layer
9
9
 
10
- Applies when writing or changing anything under `<umbrella>/`. The mechanics — frontmatter fields, tier and access vocabulary, how each tool is fed — live in `<module>/docs/CONVENTIONS.md`. This rule is the judgement that sits on top of them.
10
+ Applies when writing or changing anything under `<content-dir>/`. The mechanics — frontmatter fields, tier and access vocabulary, how each tool is fed — live in `<module>/references/conventions.md`. This rule is the judgement that sits on top of them.
11
11
 
12
12
  ## Subtraction is the job
13
13
 
@@ -25,9 +25,9 @@ Three ways to shorten, in order of what they are worth:
25
25
 
26
26
  ## Source of truth
27
27
 
28
- Edit the sources listed in `<manifest>` — the `rules/`, `agents/` and `skills/` directories it names — and `<manifest>` itself. A source that arrived from the engine or an installed package is not yours to edit either — it is replaced on the next update or install; change it in its own repository. Everything else is derived: `.claude/`, `.cursor/`, `.github/{instructions,agents,skills}/`, `.codex/`, `.agents/skills/`, `.pi/`, `.opencode/` and `AGENTS.md` are **generated output**, and a hand edit there survives exactly until the next sync.
28
+ Edit the project-owned sources listed in `<manifest>` — the `rules/`, `agents/` and `skills/` directories it names — and `<manifest>` itself. An installed package source is replaced by CLI lifecycle/package operations; change it in its own repository. Everything else is derived: `.claude/`, `.cursor/`, `.github/{instructions,agents,skills}/`, `.codex/`, `.agents/skills/`, `.pi/`, `.opencode/` and `AGENTS.md` are **generated output**, and a hand edit there survives exactly until the next sync.
29
29
 
30
- `<module>/` is the engine's own content. It owns its own rules, agents and meta-skills, and every engine update replaces it wholesale, so a local edit there is lost. Fix it upstream instead.
30
+ `<module>/` is the installed sync package's content. Package operations replace it, so a local edit there is lost. Fix it upstream instead.
31
31
 
32
32
  After any change: `<sync-cmd>`. A change that was not synced does not exist for any tool.
33
33
 
@@ -84,7 +84,7 @@ The verb just names the action — `add-`, `run-`, `review-`, `extract-`, `plan-
84
84
 
85
85
  Two verbs are told apart by what already exists. **`add-` puts one new member into a set that is already there** — a field on an existing type, a record among records, a component in the inventory the project keeps — so the noun names the member, and the number of files it takes to land is not the point. **`create-` brings the container itself into existence**, where nothing hosted it before. Neither verb describes how a skill is factored inside, so splitting a skill's internals never renames it.
86
86
 
87
- `intelligence-` is **reserved** for the engine's own artifacts. A project skill carrying that prefix collides with engine ownership — everything under the prefix is the engine's to replace or remove on update — rename it.
87
+ `intelligence-` is **reserved** for the sync package's own artifacts. A project skill carrying that prefix collides with package-owned meta-skills in generated outputs — rename it.
88
88
 
89
89
  ### Shape
90
90
 
@@ -109,6 +109,6 @@ The goal is subtraction, above. These are only the line past which something is
109
109
 
110
110
  ## Verifying a change to this layer
111
111
 
112
- The per-artifact checks are a procedure, not a constraint to hold in mind while doing other work — so they live in the meta-skills, not here. Invoke the one that matches what you are doing: `intelligence-add-rule`, `intelligence-add-agent`, `intelligence-add-skill`, `intelligence-extract-skill`, `intelligence-review-skills`, `intelligence-learn-from-context`, `intelligence-sync`, `intelligence-update`, `intelligence-install-adapter`, `intelligence-uninstall-adapter`.
112
+ The per-artifact checks are a procedure, not a constraint to hold in mind while doing other work — so they live in the meta-skills, not here. Invoke the one that matches what you are doing: `intelligence-add-rule`, `intelligence-add-agent`, `intelligence-add-skill`, `intelligence-extract-skill`, `intelligence-review-skills`, `intelligence-learn-from-repository`, `intelligence-learn-from-context`, `intelligence-sync`, `intelligence-update`, `intelligence-install-adapter`, `intelligence-uninstall-adapter`.
113
113
 
114
114
  A change to this layer is done when `<sync-cmd>` reports `IS_STATUS=ok` and the skill you invoked reports clean.
@@ -9,7 +9,7 @@ argument-hint: <domain> [description]
9
9
  ## Steps
10
10
 
11
11
  1. **Determine domain prefix** (the scope is required):
12
- - **Reuse the existing domain when one fits**: list `<umbrella>/agents/` and `<umbrella>/skills/`. If a domain prefix is already established for the target area (`backend-`, `frontend-`, `devops-`), use it. Introduce a new domain only when the scope is materially different from all existing ones.
12
+ - **Reuse the existing domain when one fits**: list `<content-dir>/agents/` and `<content-dir>/skills/`. If a domain prefix is already established for the target area (`backend-`, `frontend-`, `devops-`), use it. Introduce a new domain only when the scope is materially different from all existing ones.
13
13
  - **When no existing domain fits**, derive from repo structure:
14
14
  - Single / root project → use the project codename from `<manifest>` → `project.name`
15
15
  - Backend service / API component → `backend-`
@@ -21,7 +21,7 @@ argument-hint: <domain> [description]
21
21
  - If the repo is a monorepo with named components (e.g., `apps/billing`, `services/auth`), prefer the component name as the domain (`billing-`, `auth-`).
22
22
  - **Every agent needs a domain prefix.** If the scope is unclear, ask the user before proceeding.
23
23
 
24
- 2. **Check existing agents**: Read `<umbrella>/agents/` to avoid duplicates. If an agent for this domain exists, ask user whether to update it instead.
24
+ 2. **Check existing agents**: Read `<content-dir>/agents/` to avoid duplicates. If an agent for this domain exists, ask user whether to update it instead.
25
25
 
26
26
  3. **Determine tier and access**:
27
27
  - Developer agents: `tier: heavy`, `access: full`
@@ -36,7 +36,7 @@ argument-hint: <domain> [description]
36
36
  - Build and test commands
37
37
  - Key conventions and forbidden patterns
38
38
 
39
- 5. **Create agent**: Write `<umbrella>/agents/<domain>-<role>.md` (create the directory if missing) with frontmatter:
39
+ 5. **Create agent**: Write `<content-dir>/agents/<domain>-<role>.md` (create the directory if missing) with frontmatter:
40
40
  ```yaml
41
41
  ---
42
42
  name: <domain>-<role>
@@ -52,11 +52,11 @@ argument-hint: <domain> [description]
52
52
 
53
53
  6. **Write body** with sections: **Expertise** -> **Boundaries** -> **Build & Verify**
54
54
  - An agent is **thin**: who it is, where it stops, how it verifies. Everything else already reaches it.
55
- - **Do not tell the agent to read the rules.** Rules load on their own: Claude Code loads `.claude/rules/` into every custom subagent's startup context alongside `CLAUDE.md` (*Subagents → What loads at startup*), and Cursor / Copilot / Codex / Pi / opencode receive always-on rules inlined in `AGENTS.md`. A `Read <umbrella>/rules/<domain>.md before starting` line duplicates content the agent already has — double the tokens, and a second copy that drifts from the rule it copied.
55
+ - **Do not tell the agent to read the rules.** Rules load on their own: Claude Code loads `.claude/rules/` into every custom subagent's startup context alongside `CLAUDE.md` (*Subagents → What loads at startup*), and Cursor / Copilot / Codex / Pi / opencode receive always-on rules inlined in `AGENTS.md`. A `Read <content-dir>/rules/<domain>.md before starting` line duplicates content the agent already has — double the tokens, and a second copy that drifts from the rule it copied.
56
56
  - **Point at a rule, never restate it.** If you want to copy a rule into the agent, the rule is in the wrong place — move it, do not clone it.
57
57
  - **Do carry** what is genuinely the agent's own: its boundaries ("if the app is not running, stop — do not hand-write the output"), its verification commands, its definition of done.
58
58
  - All content must come from actual codebase analysis.
59
59
 
60
- 7. **Link existing skills**: Find skills in `<umbrella>/skills/` matching this domain prefix and add them to the agent's `skills:` frontmatter.
60
+ 7. **Link existing skills**: Find skills in `<content-dir>/skills/` matching this domain prefix and add them to the agent's `skills:` frontmatter.
61
61
 
62
62
  8. **Run `/intelligence-sync`** to distribute to all enabled IDE targets.
@@ -9,7 +9,7 @@ argument-hint: <name> [paths-glob]
9
9
  ## Steps
10
10
 
11
11
  1. **Determine rule name from domain** (the scope is required):
12
- - **Reuse the existing domain when one fits**: list `<umbrella>/rules/`. If a rule file covers the target area (e.g., `backend.md`, `frontend.md`), extend it. Introduce a new domain only when the scope is materially different from all existing rules.
12
+ - **Reuse the existing domain when one fits**: list `<content-dir>/rules/`. If a rule file covers the target area (e.g., `backend.md`, `frontend.md`), extend it. Introduce a new domain only when the scope is materially different from all existing rules.
13
13
  - **When no existing rule fits**, derive the filename from repo structure:
14
14
  - Single / root project → use the project codename from `<manifest>` → `project.name` (e.g., `<codename>.md`)
15
15
  - Backend service / API component → `backend.md`
@@ -21,7 +21,7 @@ argument-hint: <name> [paths-glob]
21
21
  - If the repo is a monorepo with named components (e.g., `apps/billing`, `services/auth`), prefer the component name as the rule name (`billing.md`, `auth.md`).
22
22
  - **Rule filenames match the domain used by skills/agents.** If the scope is unclear, ask the user before proceeding.
23
23
 
24
- 2. **Check existing rules**: Read `<umbrella>/rules/` to detect overlapping scope — favor extending an existing rule over creating a new one.
24
+ 2. **Check existing rules**: Read `<content-dir>/rules/` to detect overlapping scope — favor extending an existing rule over creating a new one.
25
25
 
26
26
  3. **Determine scope**:
27
27
  - If paths glob provided — scoped rule with `paths:` frontmatter
@@ -34,7 +34,7 @@ argument-hint: <name> [paths-glob]
34
34
  - Build and test commands specific to this scope
35
35
  - Anti-patterns observed in code, each paired with the positive replacement that should adopt instead
36
36
 
37
- 5. **Create rule**: Write `<umbrella>/rules/<name>.md` (create the directory if it does not exist — the sources list already covers it):
37
+ 5. **Create rule**: Write `<content-dir>/rules/<name>.md` (create the directory if it does not exist — the sources list already covers it):
38
38
  ```yaml
39
39
  ---
40
40
  paths:
@@ -9,7 +9,7 @@ argument-hint: <domain> <verb-noun> [description]
9
9
  ## Steps
10
10
 
11
11
  1. **Determine domain prefix** (the scope is required):
12
- - **Reuse the existing domain when one fits**: list `<umbrella>/skills/` and `<umbrella>/agents/`. If a domain prefix is already established for the target area (`backend-`, `frontend-`, `devops-`), use it. Introduce a new domain only when the scope is materially different from all existing ones.
12
+ - **Reuse the existing domain when one fits**: list `<content-dir>/skills/` and `<content-dir>/agents/`. If a domain prefix is already established for the target area (`backend-`, `frontend-`, `devops-`), use it. Introduce a new domain only when the scope is materially different from all existing ones.
13
13
  - **When no existing domain fits**, derive from repo structure:
14
14
  - Single / root project → use the project codename from `<manifest>` → `project.name`
15
15
  - Backend service / API component → `backend-`
@@ -28,13 +28,13 @@ argument-hint: <domain> <verb-noun> [description]
28
28
  - `run-` — executes an operation (tests, build, sync)
29
29
  - `review-` — read-only analysis
30
30
 
31
- 3. **Check for existing agent**: Find an agent in `<umbrella>/agents/` matching the domain
31
+ 3. **Check for existing agent**: Find an agent in `<content-dir>/agents/` matching the domain
32
32
  - If found — this skill will be linked to that agent
33
33
  - If not — ask user whether to create a new agent via `/intelligence-add-agent` first
34
34
 
35
35
  4. **Analyze codebase patterns**: Read existing implementations to extract the repeatable steps this skill should automate. Each step must come from actual code patterns, not generic knowledge.
36
36
 
37
- 5. **Create skill**: Write `<umbrella>/skills/<full-name>/SKILL.md` (create the directory if missing — no config edit needed) with frontmatter:
37
+ 5. **Create skill**: Write `<content-dir>/skills/<full-name>/SKILL.md` (create the directory if missing — no config edit needed) with frontmatter:
38
38
  ```yaml
39
39
  ---
40
40
  name: <full-name>
@@ -26,7 +26,7 @@ Both end at the same artifact format. Extract starts from observed behavior, so
26
26
  - Behavioral preference / constraint / pattern to default to → **rule** (use `intelligence-learn-from-context` for single preferences from session)
27
27
  - Knowledge area / persona / expertise scope → **agent**
28
28
 
29
- 4. **Determine domain prefix** (for skill / agent): reuse the existing domain when one fits — list `<umbrella>/skills/` and `<umbrella>/agents/`. Derive from repo structure only when no existing domain matches.
29
+ 4. **Determine domain prefix** (for skill / agent): reuse the existing domain when one fits — list `<content-dir>/skills/` and `<content-dir>/agents/`. Derive from repo structure only when no existing domain matches.
30
30
 
31
31
  5. **Determine naming** (for skill): `<domain>-<verb>-<noun>` with convention verbs — `add-` (one new member of a set that already exists), `create-` (the container itself, where nothing hosted it), `update-` (revise what is there), `run-` (execute), `review-` (read-only analysis).
32
32
 
@@ -38,7 +38,7 @@ Both end at the same artifact format. Extract starts from observed behavior, so
38
38
 
39
39
  ## Authoring guidance
40
40
 
41
- Follow the **Authoring Discipline** section in `<module>/docs/CONVENTIONS.md` when writing the artifact body — size budgets (<500 lines for SKILL.md body), imperative form, explain WHY, reserve absolute language for true invariants, lead with positive defaults.
41
+ Follow the **Authoring Discipline** section in `<module>/references/conventions.md` when writing the artifact body — size budgets (<500 lines for SKILL.md body), imperative form, explain WHY, reserve absolute language for true invariants, lead with positive defaults.
42
42
 
43
43
  ## Related skills
44
44
 
@@ -1,31 +1,38 @@
1
1
  ---
2
2
  name: intelligence-install-adapter
3
- description: "Enable IDE adapter for intelligence-sync"
4
- argument-hint: <target-name>
3
+ description: "Research, implement, and enable a tool adapter"
4
+ argument-hint: <adapter-name>
5
5
  agent: intelligence-operator
6
6
  ---
7
7
 
8
- # Install Adapter
8
+ # Install an adapter
9
9
 
10
- The project's config is `<manifest>`; the content dir is `<umbrella>/` (never assume the name or casing); the engine's own files live under `<module>/` — these paths are localized to this project at sync time.
10
+ The CLI owns adapter inventory, scaffolding, target state, and sync. This skill
11
+ owns the judgement a program cannot infer: how the target tool represents
12
+ rules, agents, and skills.
11
13
 
12
14
  ## Steps
13
15
 
14
- 1. Check whether target `$ARGUMENTS` is already enabled in `<manifest>` — if yes, report and stop.
15
-
16
- 2. **Locate the adapter.** The sync discovers adapters in two places:
17
- - **Built-in**: `<module>/scripts/adapters/$ARGUMENTS.sh` — upstream-owned. Every engine update replaces that whole directory.
18
- - **Project-owned**: `<umbrella>/adapters/$ARGUMENTS.sh` — updates never touch it. A project adapter of the same name overrides the built-in.
19
-
20
- If neither exists, research the tool's prompt format (web search for its rules / agents / skills file layout), then copy `<module>/scripts/adapters/_template.sh` to **`<umbrella>/adapters/$ARGUMENTS.sh`** and implement `sync_to_$ARGUMENTS()`. Author it there, never inside the engine's `scripts/adapters/` — a file written there is deleted by the next engine update. Adapter contract: `<module>/docs/ADAPTERS.md`. An adapter that would serve every project is worth contributing upstream.
21
-
22
- 3. Update `<manifest>`:
23
- - Target exists with `enabled: false` → flip to `enabled: true`.
24
- - Target missing → add it under `targets:` with its `output:` path.
25
- - If the target reads always-on rules from `AGENTS.md` (`cursor`, `copilot`, `codex`, `pi`, `opencode`), `targets.agents` must be enabled too — sync fails closed otherwise.
26
-
27
- 4. Add the adapter's generated paths to `.gitignore` (the paths it writes, not the whole output root — a shared root like `.github/` or `.claude/` also holds tracked, hand-authored files).
28
-
29
- 5. Run `/intelligence-sync` to generate the output.
30
-
31
- 6. Report: adapter enabled, files generated, output location.
16
+ 1. Run `intelligence adapter list`. If `$ARGUMENTS` already exists, enable it
17
+ with `intelligence adapter enable $ARGUMENTS`; that command also runs a full
18
+ sync. Continue at verification.
19
+
20
+ 2. For a missing adapter, research the tool's current authoritative
21
+ documentation: discovery paths, frontmatter/schema, scoping, naming,
22
+ agents, skills, and whether it reads `AGENTS.md`. Record links and separate
23
+ verified behavior from assumptions.
24
+
25
+ 3. Run `intelligence adapter create $ARGUMENTS`, then implement
26
+ `sync_to_$ARGUMENTS()` in the scaffolded project adapter. Follow
27
+ `<module>/references/adapters.md` and the closest built-in. Keep writes beneath
28
+ the configured output, make reruns idempotent, and make owned cleanup paths
29
+ explicit. Ignore only those owned paths; shared roots remain trackable.
30
+
31
+ 4. Run `bash -n` on the project adapter, then
32
+ `intelligence adapter enable $ARGUMENTS`. If the CLI says the adapter
33
+ requires `agents`, enable that adapter first.
34
+
35
+ 5. Require `IS_STATUS=ok`, inspect generated files against the researched
36
+ format, run the tool's validator when one exists, and finish with
37
+ `intelligence status --check`. Report evidence, output paths, and any
38
+ unsupported artifact type.
@@ -21,7 +21,7 @@ The original negative pattern stays in the rule body as an illustrative example
21
21
 
22
22
  ## Phase A — Analyze (read-only)
23
23
 
24
- 1. **Read authoring conventions first.** The paths below are localized to this project at sync time: `<umbrella>/` is the content dir, `<module>/` the engine's own files, `<manifest>` the config. The meta-skills live in `<module>/skills/`, not directly under the umbrella. Load `<module>/skills/intelligence-add-rule/SKILL.md`, `<module>/skills/intelligence-add-skill/SKILL.md`, `<module>/skills/intelligence-add-agent/SKILL.md`, and `<module>/docs/CONVENTIONS.md` (Authoring Discipline section). This skill writes nothing on its own — it delegates to the add-* skills, which carry the authoring conventions.
24
+ 1. **Read authoring conventions first.** The paths below are localized to this project at sync time: `<content-dir>/` is the project content directory, `<module>/` the installed sync package, and `<manifest>` the root manifest. The meta-skills live in `<module>/skills/`, not directly under the content directory. Load `<module>/skills/intelligence-add-rule/SKILL.md`, `<module>/skills/intelligence-add-skill/SKILL.md`, `<module>/skills/intelligence-add-agent/SKILL.md`, and `<module>/references/conventions.md` (Authoring Discipline section). This skill writes nothing on its own — it delegates to the add-* skills, which carry the authoring conventions.
25
25
 
26
26
  2. **Capture the lesson** from session context or user input. Strip session-specific detail, keep the underlying pattern.
27
27
 
@@ -32,7 +32,7 @@ The original negative pattern stays in the rule body as an illustrative example
32
32
  Confirm the translation with the user if removing the negation changes meaning.
33
33
 
34
34
  4. **Route to the right artifact type**:
35
- - Behavioral preference, tone, communication style → **rule** (`<umbrella>/rules/<name>.md`)
35
+ - Behavioral preference, tone, communication style → **rule** (`<content-dir>/rules/<name>.md`)
36
36
  - Multi-step repeatable workflow → use `intelligence-extract-skill` instead
37
37
  - Knowledge scope / persona / expertise area → **agent**
38
38
  - Project-specific context tied to a path → scoped rule with `paths:` frontmatter
@@ -58,7 +58,7 @@ Present the proposal list to the user. User accepts or rejects per item. Only ac
58
58
  - `CREATE` skill → call `intelligence-add-skill`
59
59
  - `CREATE` agent → call `intelligence-add-agent`
60
60
  - `UPDATE` existing artifact → edit the file directly, applying the proposed change
61
- - `ARCHIVE` → move to `<umbrella>/_archive/` and update cross-references that point at it
61
+ - `ARCHIVE` → move to `<content-dir>/_archive/` and update cross-references that point at it
62
62
 
63
63
  8. **Run `/intelligence-sync`** once all accepted items are applied.
64
64