@ainova-systems/intelligence 0.11.0-rc.10 → 0.11.0-rc.13

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.
@@ -283,7 +283,7 @@ Size limits are backstops, not quotas:
283
283
 
284
284
  Every line enters a finite context budget. Prefer subtraction, consolidation and precise scope over exhaustive prose.
285
285
 
286
- ## Generated output
286
+ ## Generated output and version control
287
287
 
288
288
  | Target | Rules | Skills | Agents |
289
289
  |---|---|---|---|
@@ -297,22 +297,24 @@ Every line enters a finite context budget. Prefer subtraction, consolidation and
297
297
 
298
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
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:
300
+ By default, commit the manifest, lock, project-owned content, `AGENTS.md`, and shared `.github/` output. Ignore the restorable package store and tool output owned by enabled adapters. `intelligence init` and `intelligence adapter enable` add these patterns without ignoring shared tool roots or settings:
301
301
 
302
302
  ```gitignore
303
303
  # CLI-managed package store
304
304
  .intelligence/
305
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/
306
+ # Local root instructions migrate into project rules; local preferences stay ignored
307
+ CLAUDE.md
308
+ .cursorrules
309
+
310
+ # Generated Claude and Cursor content; shared settings remain trackable
311
+ .claude/*
312
+ !.claude/settings.json
313
+ .cursor/*
314
+ !.cursor/settings.json
313
315
 
314
316
  # Generated open-standard and Codex content
315
- .agents/
317
+ .agents/skills/
316
318
  .codex/agents/
317
319
 
318
320
  # Generated Pi content
@@ -320,12 +322,27 @@ Generated IDE output may be gitignored when every collaborator can reproduce it
320
322
  .pi/extensions/intelligence-sync-rules.ts
321
323
  .pi/prompts/intelligence-agent-*.md
322
324
 
323
- # Generated OpenCode agents. Its commands directory may also contain
324
- # hand-authored files, so choose per-project ignores there.
325
+ # Generated OpenCode agents. Commands share a directory with hand-authored
326
+ # files, so they remain tracked unless the project chooses exact file ignores.
325
327
  .opencode/agents/
326
328
  ```
327
329
 
328
- Copilot output lives under `.github/`; choose whether to commit it with other repository-level GitHub configuration. Do not ignore `.github/` wholesale.
330
+ Copilot output lives under `.github/` and is committed with other repository-level GitHub configuration. Do not ignore `.github/` wholesale. `AGENTS.md` is also committed so every clone has the shared tool-neutral entry point before sync.
331
+
332
+ `AGENTS.md` is the only shared root instruction entry point. During onboarding,
333
+ move useful repository guidance from legacy root files such as `.cursorrules`
334
+ and instruction-bearing `CLAUDE.md` into project-owned rules, verify the
335
+ generated tool output, then remove the legacy file. Keep a root tool-specific
336
+ file only when it contains genuinely local configuration that an adapter cannot
337
+ represent; keep that exception gitignored rather than maintaining a second
338
+ committed instruction source.
339
+
340
+ Before the first render, `intelligence init` preserves existing AI prompt paths
341
+ under `<content-dir>/_backup/`. Its `manifest.tsv` labels the snapshot
342
+ `initial-onboarding` and lists exact original paths. The context-learning skill
343
+ first recovers or verifies CLI setup, then routes that state through
344
+ `onboarding-migration.md` and repository learning. The backup remains until the
345
+ user approves removal.
329
346
 
330
347
  ## Project-owned adapters
331
348
 
@@ -337,7 +354,7 @@ intelligence adapter create mytool
337
354
  intelligence adapter enable mytool
338
355
  ```
339
356
 
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.
357
+ Project adapters survive CLI upgrades and may override a built-in by name. Each adapter declares a versioned ownership contract beside its sync function; backup, rollback, dependencies and Git policy all consume it. `intelligence adapter enable mytool` runs a full transactional sync so shared context stays current. `intelligence adapter disable mytool` keeps generated output for explicit cleanup; a disabled project adapter can then be deleted with `intelligence adapter remove mytool`. See `adapters.md` for the interface and safety contract.
341
358
 
342
359
  ## Schema and command boundaries
343
360
 
@@ -346,7 +363,7 @@ The permanent applied-schema key is the top-level scalar `schema_version` in `in
346
363
  The public lifecycle is deliberately compact:
347
364
 
348
365
  - `intelligence init [--preview|--apply]` is universal: it creates a new setup, aligns an existing Intelligence project, or plans/applies conversion of an eligible legacy Intelligence Sync project.
349
- - `intelligence sync [adapter]` first aligns an existing Intelligence project with the installed CLI, restores a missing store strictly from `intelligence.lock`, then renders. In CI it refuses an alignment that would change tracked files and points to a local `intelligence init --apply` plus review/commit.
366
+ - `intelligence sync [adapter] [--compact]` first aligns an existing Intelligence project with the installed CLI, restores a missing store strictly from `intelligence.lock`, then renders. Compact mode shows only final status on success and all diagnostics on failure. In CI it refuses an alignment that would change tracked files and points to a local `intelligence init --apply` plus review/commit.
350
367
  - `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
368
  - `intelligence package add|remove|list|search` owns package inventory.
352
369
  - `intelligence adapter list|create|enable|disable|remove` owns adapter inventory and target state.
@@ -382,4 +399,4 @@ Callers capture the real code with `command || rc=$?`. Do not use `if ! command;
382
399
  | `<content-dir>/{rules,agents,skills,adapters}/` | Project source of truth | Tracked |
383
400
  | `.intelligence/` | Restorable package store | Ignored |
384
401
  | `AGENTS.md` | Generated canonical project context | Normally tracked |
385
- | Tool output directories | Generated native content | Project policy; use narrow ignores |
402
+ | Tool output directories | Generated native content | Built-in adapter-owned paths ignored; shared settings tracked |
@@ -0,0 +1,74 @@
1
+ # Migrating Existing AI Instructions
2
+
3
+ Read this reference only when repository onboarding finds pre-existing AI
4
+ instructions, an `<content-dir>/_backup/` created by `intelligence init`, or a
5
+ Git diff showing that the first sync replaced tracked tool output.
6
+
7
+ ## Inventory and recovery
8
+
9
+ When `<content-dir>/_backup/manifest.tsv` contains
10
+ `state<TAB>initial-onboarding`, it is the authoritative inventory from before
11
+ the first generated write. Read each `target` and `path` record before looking
12
+ at current adapter output. If `path<TAB>AGENTS.md` is present, the backed-up
13
+ file is the original custom project contract; keep following it while deciding
14
+ how to migrate its durable guidance.
15
+
16
+ Treat these as migration inputs, not as current generated output:
17
+
18
+ - root `AGENTS.md`, `CLAUDE.md`, `.cursorrules`, and
19
+ `.github/copilot-instructions.md`;
20
+ - Claude and Cursor rules, agents, skills, and commands;
21
+ - Copilot instructions, prompts, agents, and skills;
22
+ - Codex/Open Agent Skills, Pi rules/prompts, and OpenCode agents/commands;
23
+ - scripts or documentation that describe an older sync path.
24
+
25
+ Prefer the copy under `<content-dir>/_backup/`. If it is absent and the first
26
+ sync changed tracked files, inspect their pre-sync content read-only through
27
+ Git (`git diff` and `git show HEAD:<path>`). Never restore old content directly
28
+ into an adapter output directory.
29
+
30
+ Build one conflict report before proposing changes:
31
+
32
+ - `MIGRATE`: instruction-bearing files whose useful content needs a
33
+ project-owned destination;
34
+ - `PRESERVE`: settings and unrelated shared files the adapters do not own;
35
+ - `REPLACE`: adapter-owned paths that sync regenerates;
36
+ - `STALE`: references to removed paths or commands requiring a decision.
37
+
38
+ Always preserve `.claude/settings.json`, `.claude/settings.local.json`,
39
+ `.cursor/settings.json`, Git metadata, workflows, and non-AI repository files.
40
+
41
+ ## Reverse mappings
42
+
43
+ Migrate meaning, not tool syntax:
44
+
45
+ | Existing format | Project-owned destination |
46
+ |---|---|
47
+ | Root `AGENTS.md`, `CLAUDE.md`, `.cursorrules`, Copilot root instructions | Split verified guidance by topic into rules; keep local machine preferences in a gitignored root file only when no adapter representation exists |
48
+ | `.claude/rules/*.md` | Rule; preserve valid `paths:` |
49
+ | `.cursor/rules/*.mdc` | Rule; rename `globs:` to `paths:` and remove `alwaysApply:` |
50
+ | Claude/Cursor/Copilot agents | Agent; map native model/readonly/tool fields back to `tier:` and `access:` |
51
+ | Claude/Cursor/Copilot skills or commands | Skill when the procedure is repeated, multi-step, stable, and verifiable; otherwise a rule or no artifact |
52
+ | Pi/OpenCode/Codex prompt artifacts | Rule, agent, or skill according to responsibility, after removing tool-specific wrappers |
53
+
54
+ Verify every retained claim against repository code or executable
55
+ configuration. Do not preserve stale instructions merely because they existed.
56
+ Prefer updating an existing project-owned artifact to creating a sibling.
57
+
58
+ ## Apply and cleanup
59
+
60
+ Obtain approval per `CREATE`, `UPDATE`, `REMOVE`, or `KEEP` proposal. Apply
61
+ project-owned source changes first, then run `intelligence sync` and
62
+ `intelligence status --check`. Inspect the enabled targets to prove the
63
+ migrated guidance arrived before removing old root instructions or tool files.
64
+
65
+ For every removed or renamed path, search all tracked files with `git ls-files`
66
+ and report remaining references with file and line number. Apply an unambiguous
67
+ replacement directly; ask about narrative or otherwise ambiguous references.
68
+
69
+ The CLI owns generated-output `.gitignore` entries. Verify its patterns against
70
+ the enabled adapters and preserve `AGENTS.md`, `.github/`, shared settings, and
71
+ unrelated files under shared tool roots.
72
+
73
+ Keep `<content-dir>/_backup/` until the user separately approves its removal
74
+ after migration and reference checks pass. The backup remains gitignored.
@@ -22,17 +22,24 @@ rules, agents, and skills.
22
22
  agents, skills, and whether it reads `AGENTS.md`. Record links and separate
23
23
  verified behavior from assumptions.
24
24
 
25
- 3. Run `intelligence adapter create $ARGUMENTS`, then implement
26
- `sync_to_$ARGUMENTS()` in the scaffolded project adapter. Follow
25
+ 3. Run `intelligence adapter create $ARGUMENTS`, then keep
26
+ `adapter_contract_$ARGUMENTS()` aligned with every path the adapter writes
27
+ and implement `sync_to_$ARGUMENTS()` in the scaffolded project adapter. Follow
27
28
  `<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.
29
+ the configured output, make reruns idempotent, distinguish exclusive
30
+ `owned` paths from marker-based/shared `managed` paths, and declare exact
31
+ legacy, preserved, dependency, ignore, and include records when applicable.
30
32
 
31
33
  4. Run `bash -n` on the project adapter, then
32
34
  `intelligence adapter enable $ARGUMENTS`. If the CLI says the adapter
33
35
  requires `agents`, enable that adapter first.
34
36
 
37
+ The CLI derives generated-output ignores from the adapter contract. Do not
38
+ edit `.gitignore` manually; correct the contract when policy is wrong, and
39
+ never ignore a shared output root.
40
+
35
41
  5. Require `IS_STATUS=ok`, inspect generated files against the researched
36
- format, run the tool's validator when one exists, and finish with
42
+ format, deliberately fail a later test adapter to prove transactional
43
+ rollback when contributing a built-in, run the tool's validator when one exists, and finish with
37
44
  `intelligence status --check`. Report evidence, output paths, and any
38
45
  unsupported artifact type.
@@ -1,11 +1,50 @@
1
1
  ---
2
2
  name: intelligence-learn-from-context
3
- description: "Capture session lessons and apply to intelligence/ after approval"
4
- argument-hint: <optional-lesson-statement>
3
+ description: "Finalize or recover initial Intelligence onboarding, or capture one approved session lesson later"
5
4
  ---
6
5
 
7
6
  # Learn from Context
8
7
 
8
+ This is the safe continuation point after `intelligence init`. It first makes
9
+ the deterministic setup healthy. When it finds an initial-state backup, it
10
+ then follows `intelligence-learn-from-repository` to migrate repository
11
+ knowledge. Without onboarding state, it captures a lesson from the current
12
+ session as described below.
13
+
14
+ ## Recover or finish initial setup first
15
+
16
+ 1. Locate `<manifest>`, `<content-dir>`, and `<module>`. If the slash command
17
+ was not installed because the first sync failed, these instructions may
18
+ have been opened directly from
19
+ `.intelligence/packages/@ainova-systems/sync/skills/intelligence-learn-from-context/SKILL.md`.
20
+ 2. Check for `<content-dir>/_backup/manifest.tsv`. A record
21
+ `state<TAB>initial-onboarding` means the backup is the byte-preserved state
22
+ from before Intelligence first wrote adapter output. Read every `path`
23
+ record and treat those files as migration input, never generated output.
24
+ A `.intelligence/backup/config.yaml` file instead identifies a converted
25
+ legacy Intelligence Sync project; treat it as repository onboarding too and
26
+ use the converted project sources plus that config as migration evidence.
27
+ 3. Run `intelligence status --check`. If the project is missing, inconsistent,
28
+ or its first sync failed, run `intelligence init --preview`, show the exact
29
+ repair plan, and request approval. After approval run
30
+ `intelligence init --apply`. Do not reproduce manifest, package, adapter,
31
+ backup, or `.gitignore` mechanics manually.
32
+ 4. Run `intelligence sync`. Sync is transactional: a failure restores every
33
+ adapter-owned path. Resolve the reported cause and retry; do not continue
34
+ semantic migration until `IS_STATUS=ok` and `intelligence status --check`
35
+ is clean.
36
+ 5. If initial-onboarding or converted-legacy evidence exists, load
37
+ `<module>/skills/intelligence-learn-from-repository/SKILL.md` and follow its
38
+ complete analyze, approval, apply, sync, and verification procedure. A
39
+ custom original `AGENTS.md` remains authoritative migration evidence at
40
+ `<content-dir>/_backup/AGENTS.md`; the generated root `AGENTS.md` points to
41
+ it until onboarding is finalized. Keep the backup until its removal is
42
+ separately approved. Stop after repository onboarding; do not also invent a
43
+ session lesson.
44
+
45
+ Continue below only when no initial-onboarding backup exists and setup is
46
+ healthy.
47
+
9
48
  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
49
 
11
50
  ## Principle: positive framing
@@ -60,10 +99,12 @@ Present the proposal list to the user. User accepts or rejects per item. Only ac
60
99
  - `UPDATE` existing artifact → edit the file directly, applying the proposed change
61
100
  - `ARCHIVE` → move to `<content-dir>/_archive/` and update cross-references that point at it
62
101
 
63
- 8. **Run `/intelligence-sync`** once all accepted items are applied.
102
+ 8. Run `intelligence sync` once all accepted items are applied. Require
103
+ `IS_STATUS=ok`, then run `intelligence status --check`.
64
104
 
65
105
  ## Related skills
66
106
 
107
+ - `intelligence-learn-from-repository` — initial onboarding, legacy instruction migration and generated-output policy
67
108
  - `intelligence-extract-skill` — when the lesson is a multi-step workflow to be made reusable
68
109
  - `intelligence-review-skills` — broader audit across existing intelligence/ artifacts
69
110
  - `intelligence-add-rule`, `intelligence-add-skill`, `intelligence-add-agent` — each authors one artifact; Phase B delegates to them
@@ -12,24 +12,52 @@ mechanical setup; this skill adds only repository-specific judgement.
12
12
 
13
13
  1. Run `intelligence status --check`. If setup is missing or incomplete, stop
14
14
  and ask the user to run `intelligence init`; do not reproduce CLI mechanics.
15
+ A clean check proves only that the mechanical setup is healthy; do not call
16
+ repository onboarding complete while legacy instruction migration or other
17
+ proposed tailoring still awaits approval.
15
18
  2. Read `<manifest>` and resolve `<content-dir>` and the configured source
16
19
  directories. Load `<module>/references/conventions.md` and the bundled
17
20
  `intelligence-add-rule`, `intelligence-add-skill`, and
18
21
  `intelligence-add-agent` skills before proposing authored content.
22
+ When existing AI instructions, `<content-dir>/_backup/`, or overwritten
23
+ tracked tool output is present, also read
24
+ `<module>/references/onboarding-migration.md` and use its inventory,
25
+ reverse-mapping, and stale-reference procedure.
26
+ When `<content-dir>/_backup/manifest.tsv` declares
27
+ `state<TAB>initial-onboarding`, treat each `path` record as the exact
28
+ pre-Intelligence state. Never infer that files beside the backup are the
29
+ originals after sync.
19
30
  3. Inspect repository evidence: its README and contributor instructions,
20
31
  language and package manifests, build and test entry points, source layout,
21
32
  CI, existing agent instructions, and existing project-owned rules, agents,
22
- and skills. Treat documentation as a claim and verify important behavior in
23
- code or executable configuration.
24
- 4. Inventory what initialization already preserved or installed. Do not
33
+ and skills. Detect submodules and treat them as separate repositories unless
34
+ the user explicitly includes them. Treat documentation as a claim and
35
+ verify important behavior in code or executable configuration.
36
+ 4. Inventory what initialization preserved or installed. Do not
25
37
  recreate package-owned content, duplicate existing instructions, or convert
26
- generated target output into source content.
38
+ current generated target output into source content. Treat committed legacy root
39
+ instruction files such as `.cursorrules` and instruction-bearing `CLAUDE.md`
40
+ as migration sources, not permanent parallel entry points: propose moving
41
+ still-valid guidance into project-owned rules and removing the legacy file
42
+ after the generated output is verified. Keep one only for genuinely local,
43
+ gitignored configuration that an adapter cannot represent. `AGENTS.md`
44
+ remains the only shared root instruction entry point.
45
+ Review `.gitignore` against the enabled adapters and the generated-output
46
+ ownership table in the conventions. Treat missing CLI-managed patterns as a
47
+ setup correction, not as a new repository convention; preserve shared
48
+ settings and never ignore `.github/` or `AGENTS.md`.
27
49
  5. Propose the smallest useful project-owned layer. Prefer updating an existing
28
50
  artifact over creating a sibling. Each proposal must state:
29
- - `CREATE`, `UPDATE`, or `KEEP`;
51
+ - `CREATE`, `UPDATE`, `REMOVE`, or `KEEP`;
30
52
  - the source path;
31
53
  - the repository evidence supporting it;
32
54
  - the concise content or responsibility it would add.
55
+ When `targets.agents.header` is absent or generic, also propose a concise
56
+ manifest header with the project name, verified stack summary, and a link to
57
+ its canonical context rule. Keep it to 3-5 lines.
58
+ When the header says Intelligence onboarding is pending, replacing that
59
+ transitional backup pointer is part of the proposal; do not leave it after
60
+ the original `AGENTS.md` guidance has been migrated and verified.
33
61
 
34
62
  Analysis is read-only. Present the proposal and request approval per change.
35
63
  It is valid to recommend no new artifacts when the repository already explains
@@ -40,12 +68,17 @@ itself well.
40
68
  6. Apply only accepted proposals. Delegate new artifacts to
41
69
  `intelligence-add-rule`, `intelligence-add-skill`, or
42
70
  `intelligence-add-agent`; update an existing project-owned artifact directly
43
- when that is the smaller change. Never edit installed package content or
44
- generated tool output.
45
- 7. Run `intelligence sync`, then `intelligence status --check`. Completion
46
- requires `IS_STATUS=ok` and a clean consistency check.
71
+ when that is the smaller change, and edit an accepted manifest header
72
+ directly. Never edit installed package content or generated tool output.
73
+ 7. Run `intelligence sync`, then `intelligence status --check`. Inspect the
74
+ relevant generated `AGENTS.md`, Cursor rules, and Claude rules to verify that
75
+ the migrated guidance reached each enabled target. Only then remove each
76
+ separately approved legacy root instruction file and rerun the consistency
77
+ check. Completion requires `IS_STATUS=ok`, a clean final check, and no
78
+ `onboarding is pending` header after migrated guidance is accepted.
47
79
  8. Report what was created, updated, or deliberately left unchanged. Remind the
48
- user to review and commit generated and source changes according to project
80
+ user to commit source, manifest, lock, `AGENTS.md`, and shared `.github/`
81
+ changes; generated local adapter output should match the reviewed ignore
49
82
  policy.
50
83
 
51
84
  ## Related skill
@@ -82,5 +82,5 @@ The user accepts items individually; bulk-accept for low-impact tweaks is fine.
82
82
 
83
83
  ## Related skills
84
84
 
85
- - `intelligence-learn-from-context` — single-lesson capture; this skill's apply phase delegates to its Phase B
85
+ - `intelligence-learn-from-context` — setup recovery or single-lesson capture; this skill delegates accepted edits to its Phase B
86
86
  - `intelligence-extract-skill` — when the audit surfaces a workflow that should become a skill