@ainova-systems/intelligence 0.11.0-rc.1

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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -0
  3. package/bin/intelligence.js +59 -0
  4. package/cli/commands/add.sh +133 -0
  5. package/cli/commands/doctor.sh +100 -0
  6. package/cli/commands/init.sh +96 -0
  7. package/cli/commands/install.sh +84 -0
  8. package/cli/commands/list.sh +28 -0
  9. package/cli/commands/migrate.sh +251 -0
  10. package/cli/commands/registry.sh +51 -0
  11. package/cli/commands/remove.sh +39 -0
  12. package/cli/commands/status.sh +34 -0
  13. package/cli/commands/sync.sh +22 -0
  14. package/cli/commands/update.sh +59 -0
  15. package/cli/commands/upgrade.sh +27 -0
  16. package/cli/intelligence +71 -0
  17. package/cli/lib/cli-common.sh +149 -0
  18. package/cli/lib/lockfile.sh +97 -0
  19. package/cli/lib/manifest.sh +211 -0
  20. package/cli/lib/registry.sh +141 -0
  21. package/cli/lib/semver.sh +127 -0
  22. package/engine/INIT.md +498 -0
  23. package/engine/agents/intelligence-architect.md +53 -0
  24. package/engine/agents/intelligence-operator.md +49 -0
  25. package/engine/docs/ADAPTERS.md +212 -0
  26. package/engine/docs/CLI.md +91 -0
  27. package/engine/docs/CONVENTIONS.md +440 -0
  28. package/engine/rules/intelligence-authoring.md +114 -0
  29. package/engine/scripts/VERSION +1 -0
  30. package/engine/scripts/adapters/_template.sh +86 -0
  31. package/engine/scripts/adapters/agents.sh +299 -0
  32. package/engine/scripts/adapters/claude.sh +136 -0
  33. package/engine/scripts/adapters/codex.sh +118 -0
  34. package/engine/scripts/adapters/copilot.sh +193 -0
  35. package/engine/scripts/adapters/cursor.sh +146 -0
  36. package/engine/scripts/adapters/opencode.sh +200 -0
  37. package/engine/scripts/adapters/pi.sh +256 -0
  38. package/engine/scripts/lib/common.sh +1602 -0
  39. package/engine/scripts/lib/layout.sh +51 -0
  40. package/engine/scripts/lib/migrations.sh +708 -0
  41. package/engine/scripts/sync.sh +311 -0
  42. package/engine/scripts/update.sh +237 -0
  43. package/engine/skills/intelligence-add-agent/SKILL.md +62 -0
  44. package/engine/skills/intelligence-add-rule/SKILL.md +54 -0
  45. package/engine/skills/intelligence-add-skill/SKILL.md +53 -0
  46. package/engine/skills/intelligence-extract-skill/SKILL.md +47 -0
  47. package/engine/skills/intelligence-install-adapter/SKILL.md +31 -0
  48. package/engine/skills/intelligence-learn-from-context/SKILL.md +69 -0
  49. package/engine/skills/intelligence-review-skills/SKILL.md +86 -0
  50. package/engine/skills/intelligence-sync/SKILL.md +18 -0
  51. package/engine/skills/intelligence-uninstall-adapter/SKILL.md +42 -0
  52. package/engine/skills/intelligence-update/SKILL.md +159 -0
  53. package/package.json +39 -0
  54. package/registry/index.yaml +15 -0
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: intelligence-add-skill
3
+ description: "Create new skill"
4
+ argument-hint: <domain> <verb-noun> [description]
5
+ ---
6
+
7
+ # Add Skill
8
+
9
+ ## Steps
10
+
11
+ 1. **Determine domain prefix** (the scope is required):
12
+ - **Reuse the existing domain when one fits**: list `intelligence/skills/` and `intelligence/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
+ - **When no existing domain fits**, derive from repo structure:
14
+ - Single / root project → use the project codename from `intelligence/config.yaml` → `project.name`
15
+ - Backend service / API component → `backend-`
16
+ - Frontend / web / UI component → `frontend-`
17
+ - Infrastructure, IaC, CI/CD, deployment → `devops-`
18
+ - Shared library / common / cross-cutting code → `core-`
19
+ - Test suites (e2e, integration) → `tests-`
20
+ - Tool-internal (intelligence-sync itself) → `intelligence-`
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
+ - **Every skill needs a domain prefix.** If the scope is unclear, ask the user before proceeding.
23
+
24
+ 2. **Determine naming**: Build full name as `<domain>-<verb>-<noun>` using convention:
25
+ - `add-` — adds one new member to a set that already exists (a field on an existing type, a record among records)
26
+ - `create-` — brings into existence the container nothing hosted before (MUST use `create-`, never `add-`)
27
+ - `update-` — revises what is already there
28
+ - `run-` — executes an operation (tests, build, sync)
29
+ - `review-` — read-only analysis
30
+
31
+ 3. **Check for existing agent**: Find an agent in `intelligence/agents/` matching the domain
32
+ - If found — this skill will be linked to that agent
33
+ - If not — ask user whether to create a new agent via `/intelligence-add-agent` first
34
+
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
+
37
+ 5. **Create skill**: Write `intelligence/skills/<full-name>/SKILL.md` with frontmatter:
38
+ ```yaml
39
+ ---
40
+ name: <full-name>
41
+ description: "<what it does and when to use>"
42
+ argument-hint: "<expected arguments>"
43
+ agent: <matching-agent-name>
44
+ ---
45
+ ```
46
+
47
+ **YAML safety (required):** **always wrap `description`, `argument-hint` and any other free-text string value in double quotes**, regardless of content. Codex CLI uses strict YAML — an unquoted colon in `description: Build retrospective: monthly` parses as a nested mapping and the skill is rejected at startup. Quoting unconditionally removes the whole class of bug and makes lint trivial. If the value itself contains a double quote, escape it as `\"` or wrap the whole value in single quotes — e.g. `description: 'Use as a quick "what do we have" view'` — so an inner quote does not terminate the scalar early.
48
+
49
+ 6. **Write steps**: Numbered, concrete, executable. Include verification (build/test) at the end. A step that dispatches to another skill names it and never restates its content.
50
+
51
+ 7. **Update agent**: Add skill name to the `skills:` list in the matching agent's frontmatter.
52
+
53
+ 8. **Run `/intelligence-sync`** to distribute to all enabled IDE targets.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: intelligence-extract-skill
3
+ description: "Extract observed workflow into a reusable skill"
4
+ argument-hint: "<skill-name-hint> [target: skill|rule|agent]"
5
+ ---
6
+
7
+ # Extract Skill
8
+
9
+ Use when a workflow that ran during this session should become a reusable artifact — same sequence will be needed again by this user or by someone else using shared intelligence. Starts from observed session behavior instead of design-from-scratch.
10
+
11
+ ## When to use this vs `intelligence-add-skill`
12
+
13
+ - `intelligence-add-skill` — design from scratch / from codebase analysis
14
+ - `intelligence-extract-skill` — extract from the conversation that just happened
15
+
16
+ Both end at the same artifact format. Extract starts from observed behavior, so the steps already exist as real working procedure.
17
+
18
+ ## Steps
19
+
20
+ 1. **Identify the pattern from session**: list the concrete steps the assistant or user-and-assistant performed during the conversation. Include user decisions at each branch and assistant actions.
21
+
22
+ 2. **Generalize**: strip session-specific details (file names, dates, specific phrasing), keep the repeatable structure. The artifact should work for the next instance of this task type, not just the one that ran.
23
+
24
+ 3. **Determine artifact type**:
25
+ - Multi-step workflow with concrete steps → **skill**
26
+ - Behavioral preference / constraint / pattern to default to → **rule** (use `intelligence-learn-from-context` for single preferences from session)
27
+ - Knowledge area / persona / expertise scope → **agent**
28
+
29
+ 4. **Determine domain prefix** (for skill / agent): reuse the existing domain when one fits — list `intelligence/skills/` and `intelligence/agents/`. Derive from repo structure only when no existing domain matches.
30
+
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
+
33
+ 6. **Check for matching agent**: if creating a skill and an agent already covers the domain, link via `agent:` frontmatter. If no matching agent and one is warranted, call `intelligence-add-agent` first.
34
+
35
+ 7. **Write the artifact** by delegating to the relevant `intelligence-add-*` skill (`intelligence-add-skill` / `intelligence-add-rule` / `intelligence-add-agent`). The add-* skills carry the authoring conventions — no need to duplicate them here.
36
+
37
+ 8. **Run sync**: `/intelligence-sync` to distribute to all enabled IDE targets.
38
+
39
+ ## Authoring guidance
40
+
41
+ Follow the **Authoring Discipline** section in `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.
42
+
43
+ ## Related skills
44
+
45
+ - `intelligence-add-skill` — design new skill from scratch
46
+ - `intelligence-learn-from-context` — capture a behavioral preference from session (often → rule update)
47
+ - `intelligence-review-skills` — audit existing artifacts for duplication, staleness, discipline issues
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: intelligence-install-adapter
3
+ description: "Enable IDE adapter for intelligence-sync"
4
+ argument-hint: <target-name>
5
+ agent: intelligence-operator
6
+ ---
7
+
8
+ # Install Adapter
9
+
10
+ The umbrella is whatever directory holds `config.yaml` (`intelligence/`, `Intelligence/`, a codename — never assume the name or casing); the engine module is the directory under it holding `scripts/sync.sh` (conventionally `sync/`).
11
+
12
+ ## Steps
13
+
14
+ 1. Check whether target `$ARGUMENTS` is already enabled in `config.yaml` — if yes, report and stop.
15
+
16
+ 2. **Locate the adapter.** `sync.sh` discovers adapters in two places:
17
+ - **Built-in**: `<module>/scripts/adapters/$ARGUMENTS.sh` — upstream-owned. `update.sh` replaces that whole directory on every engine update.
18
+ - **Project-owned**: `<umbrella>/adapters/$ARGUMENTS.sh` — `update.sh` never touches 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 `config.yaml`:
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.
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: intelligence-learn-from-context
3
+ description: "Capture session lessons and apply to intelligence/ after approval"
4
+ argument-hint: <optional-lesson-statement>
5
+ ---
6
+
7
+ # Learn from Context
8
+
9
+ Use after a session where a meaningful preference, working pattern, or recurring friction emerged that should persist into future sessions. Runs in two phases — analyze (read-only) then apply (after user approval).
10
+
11
+ ## Principle: positive framing
12
+
13
+ LLMs follow whatever is named. Negation ("never do X") often draws attention to X. Positive framing ("default to Y", "prefer Y") steers behavior more cleanly.
14
+
15
+ This skill translates user-stated lessons before encoding:
16
+ - "Don't use NOT-comparison structures" → "State positively what IS"
17
+ - "Stop generating 3 options" → "Default to one strong recommendation"
18
+ - "Never push toward architecture framing" → "Reflect the user's framing in their own words first"
19
+
20
+ The original negative pattern stays in the rule body as an illustrative example (paired with positive replacement), but the LLM-facing instruction is positive.
21
+
22
+ ## Phase A — Analyze (read-only)
23
+
24
+ 1. **Read authoring conventions first.** Discover the paths, never assume them: the umbrella is the directory holding `config.yaml` (`intelligence/`, `Intelligence/`, a codename), and the engine module is the directory under it holding both `scripts/sync.sh` and `scripts/VERSION` (conventionally `sync/`). 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.
25
+
26
+ 2. **Capture the lesson** from session context or user input. Strip session-specific detail, keep the underlying pattern.
27
+
28
+ 3. **Translate to positive form**:
29
+ - "Never do X" → "Default to Y"
30
+ - "Stop doing Y" → "Do Z instead"
31
+ - Already-positive lessons keep as-is.
32
+ Confirm the translation with the user if removing the negation changes meaning.
33
+
34
+ 4. **Route to the right artifact type**:
35
+ - Behavioral preference, tone, communication style → **rule** (`<umbrella>/rules/<name>.md`)
36
+ - Multi-step repeatable workflow → use `intelligence-extract-skill` instead
37
+ - Knowledge scope / persona / expertise area → **agent**
38
+ - Project-specific context tied to a path → scoped rule with `paths:` frontmatter
39
+
40
+ 5. **Check for an existing artifact to extend**: list the target directory and read titles. When the lesson fits an existing artifact's scope, propose `UPDATE` rather than `CREATE`. Artifact proliferation costs context space.
41
+
42
+ 6. **Output the proposal list** — one entry per change, each with:
43
+ - Action: `CREATE` / `UPDATE` / `ARCHIVE`
44
+ - Target file path
45
+ - Brief draft of the change (positive framing applied)
46
+ - One-line reasoning
47
+
48
+ **No files are written in this phase.**
49
+
50
+ ## User approval gate
51
+
52
+ Present the proposal list to the user. User accepts or rejects per item. Only accepted items move to Phase B.
53
+
54
+ ## Phase B — Apply (after approval)
55
+
56
+ 7. For each accepted item, delegate to the appropriate add-* skill or edit directly:
57
+ - `CREATE` rule → call `intelligence-add-rule`
58
+ - `CREATE` skill → call `intelligence-add-skill`
59
+ - `CREATE` agent → call `intelligence-add-agent`
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
62
+
63
+ 8. **Run `/intelligence-sync`** once all accepted items are applied.
64
+
65
+ ## Related skills
66
+
67
+ - `intelligence-extract-skill` — when the lesson is a multi-step workflow to be made reusable
68
+ - `intelligence-review-skills` — broader audit across existing intelligence/ artifacts
69
+ - `intelligence-add-rule`, `intelligence-add-skill`, `intelligence-add-agent` — each authors one artifact; Phase B delegates to them
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: intelligence-review-skills
3
+ description: "Audit the intelligence layer for duplication, drift, size, hardcoded paths and framing"
4
+ argument-hint: "[target: rules|agents|skills|all]"
5
+ agent: intelligence-architect
6
+ ---
7
+
8
+ # Review the intelligence layer
9
+
10
+ Read-only audit of the project's rules, agents and skills, ending in a punch-list. This skill owns the **generic** audit — everything true of any repository. A project that adds laws of its own layers a thin project audit on top and invokes this one; it never re-implements these checks.
11
+
12
+ Name reflects the umbrella usage of "skills" for all AI artifacts (rules + agents + skills).
13
+
14
+ ## Scope: what to read, and what to leave alone
15
+
16
+ 1. **Resolve the layout — never assume folder names.** The umbrella is the directory holding `config.yaml`; the engine module is the directory under it holding `scripts/sync.sh` and `scripts/VERSION` (conventionally `sync/`). Read authoring conventions from `<module>/docs/CONVENTIONS.md` and the `intelligence-authoring` rule.
17
+
18
+ 2. **Enumerate from `config.yaml`, not from a guessed path.** The artifacts are exactly the directories listed under `sources.rules`, `sources.agents` and `sources.skills` — there may be several groups (e.g. a shared one and a project one), they may be nested, and an `@<pack>` (or inline `git+`) entry is a remote pack declared under `packs:`. Take the list from the config; a literal `intelligence/rules/` is wrong in any project that named things differently.
19
+
20
+ 3. **Skip everything the engine owns.** Sources under `<module>/` (`<module>/rules`, `<module>/agents`, `<module>/skills/intelligence-*`) are upstream-owned: `update.sh` replaces them wholesale, so a local "fix" there is deleted at the next update. Never propose an edit to them. If one of them is genuinely wrong, or a generic check is missing from this skill, that is a **proposal to upstream** — say so in the report rather than patching locally.
21
+
22
+ 4. **Never read or edit generated output** (`.claude/`, `.cursor/`, `.github/`, `.codex/`, `.agents/`, `.pi/`, `.opencode/`, `AGENTS.md`). Sync owns those entirely; the finding always belongs to the source.
23
+
24
+ ## Steps
25
+
26
+ 5. **Pull git history** (when available) for each artifact — last edit, edit count, first-add date. A stale candidate has no recent edits *and* nothing cross-referencing it.
27
+
28
+ 6. **Run the detection checks.** Judgement decides; the checks only make a finding evidence rather than an impression.
29
+
30
+ | Check | What it is | Proposed action |
31
+ |---|---|---|
32
+ | **Duplicate content** | Two artifacts cover overlapping scope, or their descriptions share trigger phrases | `MERGE` — present both, propose one |
33
+ | **Misplaced content** | A checklist or procedure in an agent body; a convention in an agent; a workflow in a rule; expertise in a skill (the *Pick the right artifact* table in `intelligence-authoring`) | `MOVE` — a move, not a rewrite: both files change together |
34
+ | **Over the cap** | `SKILL.md` over 1000 lines, rule over 500, agent over 200 | `SPLIT` — two artifacts, or move detail into `references/<topic>.md` |
35
+ | **Rule links to a rule** | A markdown link from one rule to another (`R1`) | `UNLINK` — name the rule instead: always-on rules are inlined into `AGENTS.md` and the scoped channels carry only scoped rules, so the link is dead in at least one output |
36
+ | **Machine facts in a rule** | OS, shell, editor or a local absolute path (`R2`) | `MOVE` — these belong in a personal, gitignored `CLAUDE.md`; a rule is committed and read by everyone, including whoever is on another platform |
37
+ | **Literal path or command in a skill** | A path *outside the skill's own folder* baked into a procedure (`R3`) | `PARAMETERIZE` — a skill is *executed*, so a literal path breaks the moment the layout moves; resolve it from a rule or from `config.yaml`. **Exempt:** the skill's own bundle (`references/`, `scripts/`, `assets/` — content is co-located with its skill by default); rules and agents (describing the repository is their job); an example inside an output-format block; the resolution step itself |
38
+ | **Skill with no verification** | Nothing at the end proves the procedure worked (`R4`) | `FLAG` — a procedure that proves nothing is a note, or just the work: give it a verification, or delete it |
39
+ | **Reserved prefix** | A project artifact named `intelligence-*` | `RENAME` — the prefix belongs to the engine, and the updater prunes what matches it |
40
+ | **Naming** | A skill that is not `<domain>-<verb>-<noun>`, or a domain invented rather than reused | `RENAME` — or introduce the new domain deliberately |
41
+ | **Stale** | No edits in 6+ months and nothing cross-references it | `ARCHIVE` — move to `<umbrella>/_archive/` |
42
+ | **Negative-framed judgement call** | "Never do X" where a positive default fits, outside safety / security / output-format | `REWRITE` — state the default; reserve NEVER for true must-nots |
43
+ | **Unbacked reason** | A rule asserts a *why* — a number, a measurement, a tool's behaviour — that nothing in the repo or in that tool's documentation supports | `FLAG` — an invented reason is worse than none: it sounds like evidence. Surface it with a draft; never rewrite the meaning yourself |
44
+ | **Always-on rule that should be scoped** | A concern that only matters in one area, loaded into every session and inlined into `AGENTS.md` | `SCOPE` — add `paths:`, or justify the cost out loud |
45
+ | **Weak / duplicate description** | Identical to a sibling, or too vague to choose between them | `DIFFERENTIATE` — add the distinguishing trigger |
46
+ | **Description over budget** | Over ~250 characters (the shared registry budget); over **1024** the tools reject the artifact outright | `TRIM` — keep the distinguishing trigger, drop the rest |
47
+ | **Missing frontmatter field** | `name` or `description` absent | `PATCH` — add it |
48
+ | **Orphan rule** | Nothing points at it and nothing loads it | `FLAG` — intentional, or dead? |
49
+
50
+ Detection commands, portable on purpose — no `\b` and no `-P`, so the same command works in Git Bash on Windows, on macOS (BSD grep) and on Linux. Run each over the source directories resolved in step 2, never over generated output:
51
+
52
+ ```sh
53
+ # R1 — a markdown link from one rule to another
54
+ grep -rnE '\]\([^)]*\.md\)' <rule-dirs>
55
+
56
+ # R2 — machine facts in a rule (a shell, someone's home directory, a drive letter)
57
+ grep -rinE 'powershell|cmd\.exe|/Users/|/home/|[A-Za-z]:[\\]' <rule-dirs>
58
+
59
+ # R3 — a path baked into a skill's steps, excluding the skill's own bundle
60
+ grep -rnE --include=SKILL.md '[A-Za-z0-9._-]+/[A-Za-z0-9._/-]+\.[A-Za-z0-9]+' <skill-dirs> \
61
+ | grep -vE '(^|[^A-Za-z0-9._/-])(references|scripts|assets)/'
62
+
63
+ # R4 — skills whose body never mentions verifying anything (-L lists files with NO match)
64
+ grep -riLE --include=SKILL.md 'verif|expect|assert|check|test|IS_STATUS' <skill-dirs>
65
+ ```
66
+
67
+ `R4` is a coarse net, not a verdict: a skill that merely *mentions* a verification command anywhere passes it. Read the final step of every skill regardless — the question is whether something at the end **proves the work landed**, not whether the word appears.
68
+
69
+ 7. **Ask subtraction first.** Before proposing any `SPLIT`, `REWRITE` or `PATCH`, ask whether the artifact should exist at all, whether two should become one, and whether the rule could be replaced by a gate the model cannot skip. A deletion is a better outcome than a tidy-up, and the punch-list should say so when it is true.
70
+
71
+ 8. **Build the punch-list**: finding, target file, proposed action, one-line reasoning, priority (1 = high-impact: duplication, misplaced content, an artifact that should not exist; 3 = low: description tweaks). Read-only — this skill writes nothing.
72
+
73
+ ## User approval gate
74
+
75
+ The user accepts items individually; bulk-accept for low-impact tweaks is fine. Anything that changes **meaning** (a law, a boundary, a gate, an unbacked reason) is surfaced with a draft and left to the human who owns it — never auto-fixed.
76
+
77
+ ## Apply phase
78
+
79
+ 9. Accepted items go to `intelligence-learn-from-context` Phase B, which owns the write machinery — do not invent a second apply path. Pass the action, the target file, the drafted change and the reasoning.
80
+
81
+ 10. Run `/intelligence-sync` once, after all accepted items are applied, and report one line per artifact: **pass / fixed (what) / flagged (for whom)**.
82
+
83
+ ## Related skills
84
+
85
+ - `intelligence-learn-from-context` — single-lesson capture; this skill's apply phase delegates to its Phase B
86
+ - `intelligence-extract-skill` — when the audit surfaces a workflow that should become a skill
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: intelligence-sync
3
+ description: "Sync intelligence to enabled IDE targets"
4
+ agent: intelligence-operator
5
+ context: fork
6
+ ---
7
+
8
+ Run the sync engine to transform rules, agents, and skills from the intelligence source directory to each enabled IDE's native format.
9
+
10
+ > **Folder name:** `<intel>` is whatever holds your `config.yaml` — typically `intelligence/`, but may have been renamed (e.g. `Intelligence/`). The engine lives in the module subfolder `<intel>/sync/` and is self-locating, so any spelling works as long as you point bash at the right `sync/scripts/sync.sh` path.
11
+ >
12
+ > **sync.sh never migrates.** It is a pure synchronizer: on a pre-0.3.1 / non-modular layout or an un-applied schema it **fails closed** with `IS_STATUS=needs-update` (exit 6) and changes nothing. Migration is owned entirely by the `intelligence-update` flow — tell your agent *"Update intelligence-sync"* (or run `<intel>/sync/scripts/update.sh`) first, then re-run sync.
13
+
14
+ ## Steps
15
+
16
+ 1. Run `bash <intel>/sync/scripts/sync.sh` (where `<intel>` is your intelligence source folder; default `intelligence`).
17
+ 2. Review the output — verify rule, agent, and skill counts per target.
18
+ 3. If warnings about unsynced directories appear, add the missing paths to `<intel>/config.yaml` under `sources:`.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: intelligence-uninstall-adapter
3
+ description: "Disable IDE adapter and clean up output"
4
+ argument-hint: <target-name>
5
+ agent: intelligence-operator
6
+ ---
7
+
8
+ # Uninstall Adapter
9
+
10
+ The umbrella is whatever directory holds `config.yaml` (`intelligence/`, `Intelligence/`, a codename — never assume the name or casing); the engine module is the directory under it holding `scripts/sync.sh` (conventionally `sync/`).
11
+
12
+ ## Steps
13
+
14
+ 1. Set `enabled: false` for the target in `config.yaml`.
15
+
16
+ 2. **Remove only the paths the adapter owns — never the output root.** Several adapters write into a shared root that also holds files nobody generated: `.github/` holds `workflows/`, `.claude/` holds `settings.json`, `.opencode/` holds `opencode.json`. Deleting the root destroys hand-authored work, and no adapter ever does that on re-sync.
17
+
18
+ | Target | Remove | Keep (never adapter-owned) |
19
+ |---|---|---|
20
+ | `claude` | `.claude/rules/`, `.claude/agents/`, skill subdirs in `.claude/skills/` | `.claude/` itself, `settings.json`, `settings.local.json`, `commands/` |
21
+ | `cursor` | `.cursor/rules/`, `.cursor/agents/`, `.cursor/skills/` | `.cursor/` itself, `settings.json` |
22
+ | `copilot` | `.github/instructions/`, `.github/prompts/`, `.github/agents/`, skill subdirs in `.github/skills/` | `.github/` itself, `workflows/`, `ISSUE_TEMPLATE/`, a hand-authored `copilot-instructions.md` |
23
+ | `codex` | `.codex/agents/` | `.codex/` itself |
24
+ | `pi` | `.pi/intelligence-sync/`, `.pi/extensions/intelligence-sync-rules.ts`, `.pi/prompts/intelligence-agent-*.md` | `.pi/settings.json`, any other extension or prompt |
25
+ | `opencode` | `.opencode/agents/`, and only the files in `.opencode/commands/` carrying the `<!-- Generated by intelligence-sync. Do not edit manually. -->` marker | `.opencode/opencode.json`, hand-authored commands |
26
+ | `agents` | `AGENTS.md` — only if the user confirms; it is a committed project doc | — |
27
+
28
+ `.agents/skills/` is **shared** by `codex`, `pi` and `opencode`. Remove it only when none of those three remains enabled.
29
+
30
+ For an adapter not in this table (a project adapter under `<umbrella>/adapters/`), read its `sync_to_<name>()` cleanup block: whatever it deletes on every re-sync is exactly what it owns.
31
+
32
+ 3. Remove the adapter's paths from `.gitignore` if nothing else needs them.
33
+
34
+ 4. Run `/intelligence-sync` to regenerate the remaining targets.
35
+
36
+ 5. **Verify** — an uninstall that removed the wrong thing must not pass quietly:
37
+ - sync reports `IS_STATUS=ok`;
38
+ - every path listed under *Remove* for this target is gone;
39
+ - every path listed under *Keep* still exists, with its content intact (`.github/workflows/`, `.claude/settings.json`, `.opencode/opencode.json`, hand-authored commands);
40
+ - the other enabled targets still produce their output.
41
+
42
+ 6. Report: adapter disabled, which paths were removed, which were deliberately kept, and the verification result.
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: intelligence-update
3
+ description: "Update or migrate intelligence-sync: discover engine, read changelog, run migration chain, verify"
4
+ argument-hint: "[--yes]"
5
+ agent: intelligence-operator
6
+ ---
7
+
8
+ # Update intelligence-sync
9
+
10
+ You are the **intelligent driver** of an update. The bash engine is
11
+ deterministic and fail-closed — it never guesses; on any state it cannot
12
+ resolve it prints `IS_STATUS=<code>` and stops. Your job: discover the engine,
13
+ understand what is changing (read the CHANGELOG across the version gap), run
14
+ the migration chain, branch on the status, and **verify afterward**. Ask the
15
+ user only when genuinely ambiguous.
16
+
17
+ Trigger: the user says something like *"update / migrate intelligence-sync"*.
18
+ They never run shell commands by hand — you do.
19
+
20
+ ## Key facts
21
+
22
+ - **Umbrella** = whatever directory holds `config.yaml` (`intelligence/`,
23
+ `Intelligence/`, …). Never assume the name — find it.
24
+ - **Engine = a module discovered by ROLE, not by name**: a directory under
25
+ the umbrella whose `scripts/sync.sh` **and** `scripts/VERSION` both exist
26
+ (conventionally `sync/`, but never assume the folder name).
27
+ - **Applied schema version** is the frozen contract key
28
+ `sync_version` in `config.yaml` (a permanent top-level scalar;
29
+ absent ⇒ pre-0.3.1). **Engine version** is `<module>/scripts/VERSION`.
30
+ The gap between them is the set of breaking changes to apply.
31
+ - Pre-0.3.1 projects have the engine flat at `<umbrella>/scripts/` and **no**
32
+ `sync_version` key. Their frozen `update.sh` fails closed
33
+ against the modular upstream (changes nothing) — you bootstrap the first hop.
34
+ - The `intelligence-` skill prefix is **reserved** for upstream meta-skills.
35
+
36
+ ## Steps
37
+
38
+ ### 1. Locate the umbrella & discover the engine
39
+ Find the dir containing `config.yaml` → `<umbrella>`. Then find the engine by
40
+ role: search `<umbrella>` (one level deep) for a directory `<M>` with both
41
+ `<M>/scripts/sync.sh` and `<M>/scripts/VERSION`.
42
+
43
+ - Several candidates → pick the one with the highest `scripts/VERSION`.
44
+ - A module engine exists → use it; **never** fall back to a flat
45
+ `<umbrella>/scripts/` even if present (that's stale legacy).
46
+ - No module engine, only flat `<umbrella>/scripts/` (or nothing) → this is a
47
+ pre-0.3.1 / un-bootstrapped project; go to step 2's bootstrap.
48
+ - No `config.yaml` at all → not bootstrapped; point the user at upstream
49
+ `INIT.md` and stop.
50
+
51
+ ### 2. Fetch upstream (read-only) — do NOT write into the project yet
52
+ Clone upstream into a temp dir (default
53
+ `https://github.com/ainova-systems/intelligence-sync`, or the user's
54
+ `REPO_URL`/fork). The upstream module is always `intelligence/sync/`.
55
+
56
+ ```
57
+ git clone --depth=1 <repo> <tmp>
58
+ ```
59
+
60
+ **Make no changes to the project before step 3's confirmation.** In
61
+ particular do not copy anything into `<umbrella>/sync` yet — that would
62
+ modify (and could downgrade) an already-modular project even if the user then
63
+ declines. The temp clone is only for reading the CHANGELOG and as the source
64
+ for the eventual write.
65
+
66
+ ### 3. Understand what is changing (changelog-aware)
67
+ Determine the project's current version = the `sync_version`
68
+ value in `config.yaml`, or `0.0.0` if the key is absent (pre-0.3.1). The
69
+ engine version = `<tmp>/intelligence/sync/scripts/VERSION`.
70
+
71
+ Read `<tmp>/CHANGELOG.md`. For every release in the range
72
+ **`current < release <= engine`** (inclusive of the target release — its
73
+ entry holds the destination's breaking post-conditions), read its entry. Pay
74
+ special attention to any **`### Breaking`** subsection (the
75
+ machine-distinguishable marker). Build a short list of breaking items, new
76
+ migrations, and anything to verify afterward. Surface it to the user; without
77
+ `--yes`, let them confirm before any write.
78
+
79
+ ### 3a. Ensure the engine to run (only now, post-confirmation)
80
+ - **Modular project** (a module engine was discovered in step 1): run *its*
81
+ `update.sh` — at the discovered module dir, whatever its name. `update.sh`
82
+ re-clones upstream internally, shows the diff, and is authoritative; do not
83
+ hand-copy over the module.
84
+ - **No module engine** (pre-0.3.1 flat or un-bootstrapped): only here create
85
+ the module from the temp clone, and only after confirmation:
86
+ ```
87
+ mkdir -p <umbrella>/sync
88
+ cp -r <tmp>/intelligence/sync/. <umbrella>/sync/
89
+ ```
90
+ then run `<umbrella>/sync/scripts/update.sh`.
91
+
92
+ ### 4. Run the engine
93
+ Run the `update.sh` of the engine determined in 3a — the **discovered module
94
+ dir** for a modular project (whatever its name), or the just-created
95
+ `<umbrella>/sync` for the legacy bootstrap path:
96
+
97
+ ```
98
+ bash <engine-module>/scripts/update.sh --yes # omit --yes to confirm the diff
99
+ ```
100
+ Capture stdout; find the last `IS_STATUS=<code> [IS_DETAIL=...]` line.
101
+
102
+ ### 5. Branch on `IS_STATUS`
103
+
104
+ | Code | Meaning | Action |
105
+ |---|---|---|
106
+ | `ok` | Already current | Go to step 6. |
107
+ | `migrated` | Migration chain applied | Go to step 6; note the relocation/changes. |
108
+ | `aborted-incomplete` | Staged module incomplete; legacy intact (safe) | Re-run step 2–4 once (clone hiccup). Persists → show output, stop, don't hand-fix. |
109
+ | `ahead-of-engine` | Project schema newer than this engine | Do **not** downgrade. Point `REPO_URL` at the correct/newer upstream, or accept it's already ahead. Stop. |
110
+ | `needs-update` | Pending breaking changes (sync refused) | Expected pre-migration; proceed — `update.sh` is the migrator. If it persists *after* update, investigate. |
111
+ | `config-missing` | No `config.yaml` | Not bootstrapped — direct user to `<umbrella>/sync/INIT.md`. Stop. |
112
+ | `error` | Engine couldn't proceed | Show message; check `REPO_URL`. Stop. |
113
+ | *(no status)* | Engine crashed before contract | Show full output; don't modify the tree. Stop. |
114
+
115
+ On any failure code, first re-read the upstream `CHANGELOG.md` entries for `current < release <= engine` (esp. `### Breaking`) — the breaking change usually explains the error and what the user must do — before retrying or escalating.
116
+
117
+ Genuinely **ambiguous** tree (e.g. both a legacy flat `<umbrella>/scripts/`
118
+ and a populated module, no clear `sync_version`): inspect both,
119
+ summarize the difference, ask the user which is authoritative, apply their
120
+ choice. Never guess.
121
+
122
+ ### 6. Verify (always, after `ok`/`migrated`)
123
+
124
+ Structural — always:
125
+ - No `intelligence-*` directory directly under `<umbrella>/skills/`
126
+ (meta-skills live only in the module's `skills/`).
127
+ - Project content intact: `<umbrella>/{rules,agents}/` and any
128
+ non-`intelligence-` skills untouched.
129
+ - `config.yaml` has `sync_version` equal to the engine
130
+ `scripts/VERSION`, and `sources.skills` includes the module skills path
131
+ exactly once.
132
+
133
+ Changelog-driven — per release crossed:
134
+ - For each **`### Breaking`** item in the crossed range, verify its stated
135
+ post-condition actually holds (e.g. a removed/renamed file is gone, a
136
+ config-schema change is reflected). If a breaking item has no verifiable
137
+ post-condition, state that you could not auto-verify it.
138
+
139
+ Then regenerate IDE outputs:
140
+ ```
141
+ bash <umbrella>/sync/scripts/sync.sh
142
+ ```
143
+ Relay any model-drift report. Finally summarize: versions before→after, the
144
+ breaking changes applied, verification result, anything the user must act on.
145
+ Clean up the temp clone.
146
+
147
+ ## Notes
148
+
149
+ - Everything is **idempotent**. Re-running on a current project is a safe
150
+ no-op (`IS_STATUS=ok`).
151
+ - Correctness rests on the engine's idempotent structural preconditions, not
152
+ on the version stamp — a missing/wrong `sync_version` cannot
153
+ cause a needed migration to be skipped; it only weakens the
154
+ `ahead-of-engine` guard until re-stamped.
155
+ - Never touch `config.yaml` beyond what the engine does (the idempotent
156
+ `sources.skills` line and the `sync_version` key). Never
157
+ move/delete project skills, rules, or agents.
158
+ - Sibling modules beside the engine module are independent — only operate on
159
+ the discovered engine module.
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@ainova-systems/intelligence",
3
+ "version": "0.11.0-rc.1",
4
+ "description": "Build, version and distribute AI agent intelligence across your organization — one CLI, versioned Intelligence Packages, and a sync engine for Claude Code, Cursor, Copilot, Codex, Pi and OpenCode.",
5
+ "bin": {
6
+ "intelligence": "bin/intelligence.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "cli",
11
+ "engine",
12
+ "registry"
13
+ ],
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/ainova-systems/intelligence-sync.git"
21
+ },
22
+ "homepage": "https://github.com/ainova-systems/intelligence-sync#readme",
23
+ "bugs": {
24
+ "url": "https://github.com/ainova-systems/intelligence-sync/issues"
25
+ },
26
+ "keywords": [
27
+ "ai",
28
+ "agents",
29
+ "claude-code",
30
+ "cursor",
31
+ "copilot",
32
+ "codex",
33
+ "agents-md",
34
+ "rules",
35
+ "skills",
36
+ "prompt-engineering",
37
+ "package-manager"
38
+ ]
39
+ }
@@ -0,0 +1,15 @@
1
+ # The default Intelligence Registry index, bundled with the CLI.
2
+ #
3
+ # Maps a package name to the git repo (and path inside it) the package lives
4
+ # in. Needed exactly when a name is not the repo — monorepos like
5
+ # intelligence-dev-packs. A name absent here falls through to the convention:
6
+ # @org/name -> https://github.com/org/name.git, content at the repo root.
7
+ # Organizations override or extend this per scope with `intelligence registry
8
+ # add @scope <registry-repo-url>`.
9
+ packages:
10
+ "@ainova-systems/core":
11
+ url: "https://github.com/ainova-systems/intelligence-dev-packs.git"
12
+ path: "packs/core"
13
+ "@ainova-systems/spec":
14
+ url: "https://github.com/ainova-systems/intelligence-dev-packs.git"
15
+ path: "packs/spec"