@ainova-systems/intelligence 0.11.0-rc.9 → 0.11.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 (47) hide show
  1. package/cli/commands/adapter.sh +46 -6
  2. package/cli/commands/init.sh +182 -33
  3. package/cli/commands/package.sh +2 -2
  4. package/cli/commands/registry.sh +3 -3
  5. package/cli/commands/status.sh +4 -4
  6. package/cli/commands/sync.sh +76 -23
  7. package/cli/commands/update.sh +1 -1
  8. package/cli/intelligence +18 -3
  9. package/cli/internal/{upgrade-v2.sh → align-project.sh} +9 -8
  10. package/cli/internal/check.sh +51 -2
  11. package/cli/internal/{migrate-v1.sh → convert-legacy.sh} +33 -29
  12. package/cli/internal/package-add.sh +1 -1
  13. package/cli/internal/package-list.sh +1 -1
  14. package/cli/internal/package-remove.sh +1 -1
  15. package/cli/internal/package-search.sh +1 -1
  16. package/cli/internal/package-update.sh +1 -1
  17. package/cli/internal/restore.sh +1 -1
  18. package/cli/internal/target-state.sh +26 -18
  19. package/cli/lib/adapter-lifecycle.sh +43 -0
  20. package/cli/lib/cli-common.sh +12 -8
  21. package/cli/lib/gitignore.sh +215 -0
  22. package/cli/lib/manifest.sh +35 -1
  23. package/cli/lib/onboarding.sh +137 -0
  24. package/engine/ENGINE_SHA +1 -1
  25. package/engine/VERSION +1 -1
  26. package/engine/adapters/_template.sh +19 -2
  27. package/engine/adapters/agents.sh +14 -3
  28. package/engine/adapters/claude.sh +15 -0
  29. package/engine/adapters/codex.sh +11 -1
  30. package/engine/adapters/copilot.sh +11 -0
  31. package/engine/adapters/cursor.sh +15 -0
  32. package/engine/adapters/opencode.sh +13 -2
  33. package/engine/adapters/pi.sh +18 -5
  34. package/engine/lib/adapter-contract.sh +100 -0
  35. package/engine/lib/common.sh +5 -0
  36. package/engine/lib/contract.sh +2 -2
  37. package/engine/sync.sh +87 -25
  38. package/package.json +1 -1
  39. package/packages/sync/agents/intelligence-architect.md +2 -2
  40. package/packages/sync/references/adapters.md +51 -7
  41. package/packages/sync/references/conventions.md +60 -21
  42. package/packages/sync/references/onboarding-migration.md +87 -0
  43. package/packages/sync/skills/intelligence-install-adapter/SKILL.md +12 -5
  44. package/packages/sync/skills/intelligence-learn-from-context/SKILL.md +23 -4
  45. package/packages/sync/skills/intelligence-learn-from-repository/SKILL.md +94 -38
  46. package/packages/sync/skills/intelligence-review-skills/SKILL.md +1 -1
  47. package/packages/sync/skills/intelligence-sync/SKILL.md +9 -1
@@ -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,12 +1,29 @@
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: "Capture one approved lesson from a session in an established Intelligence project"
5
4
  ---
6
5
 
7
6
  # Learn from Context
8
7
 
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).
8
+ Use after repository onboarding is complete and a meaningful preference,
9
+ working pattern, or recurring friction emerged during the current session and
10
+ should persist. It runs analyze (read-only), then apply after approval. This
11
+ skill extends an established project; it does not perform first-run repository
12
+ analysis or migrate legacy instructions.
13
+
14
+ ## Onboarding gate
15
+
16
+ 1. Locate `<manifest>`, `<content-dir>`, and `<module>`, then run
17
+ `intelligence status --check`.
18
+ 2. If setup is missing or inconsistent, stop and ask the user to repair it with
19
+ `intelligence init`; then use `/intelligence-learn-from-repository`. Do not
20
+ reproduce CLI mechanics.
21
+ 3. If the generated header says onboarding is pending, or preserved legacy
22
+ evidence still has unresolved instructions, stop and route to
23
+ `/intelligence-learn-from-repository`. A retained
24
+ `<content-dir>/_backup/manifest.tsv` or converted legacy config alone does
25
+ not mean onboarding is incomplete; those may remain as intentionally kept
26
+ evidence after the transitional header and conflicts are resolved.
10
27
 
11
28
  ## Principle: positive framing
12
29
 
@@ -60,10 +77,12 @@ Present the proposal list to the user. User accepts or rejects per item. Only ac
60
77
  - `UPDATE` existing artifact → edit the file directly, applying the proposed change
61
78
  - `ARCHIVE` → move to `<content-dir>/_archive/` and update cross-references that point at it
62
79
 
63
- 8. **Run `/intelligence-sync`** once all accepted items are applied.
80
+ 8. Run `intelligence sync` once all accepted items are applied. Require
81
+ `IS_STATUS=ok`, then run `intelligence status --check`.
64
82
 
65
83
  ## Related skills
66
84
 
85
+ - `intelligence-learn-from-repository` — first-run onboarding and legacy instruction migration; use it before this skill
67
86
  - `intelligence-extract-skill` — when the lesson is a multi-step workflow to be made reusable
68
87
  - `intelligence-review-skills` — broader audit across existing intelligence/ artifacts
69
88
  - `intelligence-add-rule`, `intelligence-add-skill`, `intelligence-add-agent` — each authors one artifact; Phase B delegates to them
@@ -1,55 +1,111 @@
1
1
  ---
2
2
  name: intelligence-learn-from-repository
3
- description: "Tailor Intelligence to an initialized repository"
3
+ description: "Recover and complete first-time Intelligence repository onboarding"
4
4
  ---
5
5
 
6
6
  # Learn from Repository
7
7
 
8
- Use after `intelligence init` creates or converts a project. The CLI owns the
9
- mechanical setup; this skill adds only repository-specific judgement.
8
+ Use once after `intelligence init` creates or converts a project. This is the
9
+ only skill that owns initial backup migration, interrupted-setup recovery, and
10
+ the first repository-specific Intelligence layer. The CLI owns deterministic
11
+ mechanics; this skill supplies repository judgement.
10
12
 
11
- ## Analyze
13
+ ## Recover or verify setup
12
14
 
13
- 1. Run `intelligence status --check`. If setup is missing or incomplete, stop
14
- and ask the user to run `intelligence init`; do not reproduce CLI mechanics.
15
- 2. Read `<manifest>` and resolve `<content-dir>` and the configured source
16
- directories. Load `<module>/references/conventions.md` and the bundled
15
+ 1. Locate `<manifest>`, `<content-dir>`, and `<module>`. If first sync failed
16
+ before the slash command was installed, these instructions can be opened
17
+ directly from
18
+ `.intelligence/packages/@ainova-systems/sync/skills/intelligence-learn-from-repository/SKILL.md`.
19
+ 2. Inspect `<content-dir>/_backup/manifest.tsv`. A
20
+ `state<TAB>initial-onboarding` record identifies the byte-preserved state
21
+ from before Intelligence first wrote adapter output. Read every `path`
22
+ record and treat it as migration input, never generated output. `legacy`
23
+ records name old entry points the CLI quarantined for the first successful
24
+ render; read their backup copies rather than restoring them. A
25
+ `.intelligence/backup/config.yaml` file identifies a converted legacy
26
+ Intelligence Sync project; use the converted sources and that config as
27
+ migration evidence.
28
+ 3. Run `intelligence status --check`. If the project is missing, inconsistent,
29
+ or its first sync failed, run `intelligence init --preview`, show the exact
30
+ repair plan, and request approval. After approval run
31
+ `intelligence init --apply`. Do not reproduce manifest, package, adapter,
32
+ backup, or ignore-file mechanics manually.
33
+ 4. Run `intelligence sync`. Sync is transactional: a failure restores every
34
+ adapter-owned path. Resolve the reported cause and retry. Do not begin
35
+ semantic migration until `IS_STATUS=ok` and `intelligence status --check`
36
+ is clean.
37
+
38
+ ## Analyze repository evidence
39
+
40
+ 5. Read `<manifest>` and resolve the configured source directories. Load
41
+ `<module>/references/conventions.md` and the bundled
17
42
  `intelligence-add-rule`, `intelligence-add-skill`, and
18
- `intelligence-add-agent` skills before proposing authored content.
19
- 3. Inspect repository evidence: its README and contributor instructions,
20
- language and package manifests, build and test entry points, source layout,
21
- 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
43
+ `intelligence-add-agent` skills before proposing authored content. When
44
+ preserved or legacy instructions exist, also read
45
+ `<module>/references/onboarding-migration.md` and use its inventory,
46
+ reverse-mapping, packaging-safety, and stale-reference procedures.
47
+ 6. Inspect the README and contributor instructions, language and package
48
+ manifests, build and test entry points, source layout, CI, existing agent
49
+ instructions, and project-owned rules, agents, and skills. Detect
50
+ submodules and treat them as separate repositories unless the user includes
51
+ them. Treat documentation as a claim and verify important behavior in code
52
+ or executable configuration.
53
+ 7. Inventory what initialization preserved or installed. Compare project-owned
54
+ rules, agents, and skills with every configured package source. Do not
25
55
  recreate package-owned content, duplicate existing instructions, or convert
26
- generated target output into source content.
27
- 5. Propose the smallest useful project-owned layer. Prefer updating an existing
28
- artifact over creating a sibling. Each proposal must state:
29
- - `CREATE`, `UPDATE`, or `KEEP`;
56
+ generated target output into source content. When a project artifact is
57
+ materially covered by package content, propose `REMOVE` or a smaller
58
+ `UPDATE`; require a content comparison, not merely a matching name.
59
+
60
+ Treat backed-up legacy root instructions such as `.cursorrules` and an
61
+ instruction-bearing `CLAUDE.md` as migration sources, not permanent parallel
62
+ entry points. Move still-valid shared guidance into project-owned rules; do
63
+ not restore the original monolith. Only when approved machine-local guidance
64
+ remains, create a small new gitignored `CLAUDE.md` from that subset after
65
+ migration. `AGENTS.md` remains the shared root instruction entry point.
66
+
67
+ Review `.gitignore` and every existing `.vscodeignore`, `.npmignore`, and
68
+ `.dockerignore` against the CLI-managed policy. Detect tracked files which
69
+ still bypass newly added Git ignore rules. Treat missing managed patterns as
70
+ setup corrections, preserve unrelated entries, and verify actual package or
71
+ build contents before release.
72
+ 8. Propose the smallest useful project-owned layer. Prefer updating an existing
73
+ artifact over creating a sibling. Each proposal states:
74
+ - `CREATE`, `UPDATE`, `REMOVE`, or `KEEP`;
30
75
  - the source path;
31
- - the repository evidence supporting it;
32
- - the concise content or responsibility it would add.
76
+ - repository evidence;
77
+ - the concise content or responsibility it adds.
33
78
 
34
- Analysis is read-only. Present the proposal and request approval per change.
35
- It is valid to recommend no new artifacts when the repository already explains
36
- itself well.
79
+ When `targets.agents.header` is absent or generic, also propose a concise
80
+ manifest header with the project name, verified stack summary, and link to
81
+ its canonical context rule. Keep it to 3-5 lines. Replacing any
82
+ `onboarding is pending` backup pointer is part of completion.
83
+
84
+ Analysis is read-only. Present the proposal and request approval per change. It
85
+ is valid to recommend no authored artifacts when the repository already
86
+ explains itself well.
37
87
 
38
88
  ## Apply after approval
39
89
 
40
- 6. Apply only accepted proposals. Delegate new artifacts to
90
+ 9. Apply only accepted proposals. Delegate new artifacts to
41
91
  `intelligence-add-rule`, `intelligence-add-skill`, or
42
92
  `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.
47
- 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
49
- policy.
50
-
51
- ## Related skill
52
-
53
- Use `intelligence-learn-from-context` later to preserve a lesson learned during
54
- a working session. This skill learns the repository's existing structure and
55
- workflow during onboarding.
93
+ when smaller, and edit an accepted manifest header directly. Never edit
94
+ installed package content or generated tool output.
95
+ 10. Run `intelligence sync`, then `intelligence status --check`. Inspect the
96
+ relevant generated `AGENTS.md`, Cursor rules, Claude rules, and any
97
+ packaging/build file list affected by ignore policy. Verify quarantined
98
+ legacy root entry points remain absent. If the user approved a genuinely
99
+ machine-local exception, create a concise new gitignored root file from only
100
+ that content; never copy the backed-up monolith back. Completion requires
101
+ `IS_STATUS=ok`, a clean final check, and no `onboarding is pending` header
102
+ after accepted migration.
103
+ 11. Report what was created, updated, removed, or deliberately kept. Remind the
104
+ user to commit source, manifest, lock, `AGENTS.md`, and shared `.github/`
105
+ changes. Keep or remove the initial backup only by separate user approval.
106
+
107
+ ## Later learning
108
+
109
+ After onboarding is complete, use `/intelligence-learn-from-context` to capture
110
+ a durable lesson from a working session. It does not repeat repository
111
+ onboarding.
@@ -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` — single-session 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
@@ -8,7 +8,7 @@ context: fork
8
8
  # Sync intelligence
9
9
 
10
10
  1. Run `intelligence sync` (or `intelligence sync <adapter>` when one adapter
11
- was requested). For v2, this command first aligns project schema/content
11
+ was requested). For Intelligence projects, this command first aligns project schema/content
12
12
  with the installed CLI and restores a missing package store strictly from
13
13
  `intelligence.lock`.
14
14
  2. Require final `IS_STATUS=ok`; relay per-adapter counts and any model-drift
@@ -18,3 +18,11 @@ context: fork
18
18
  commit its diff; never bypass the gate. A frozen restore refusal means the
19
19
  manifest and lock disagree or a pinned ref moved—report it without
20
20
  hand-copying package content.
21
+ 4. On a probable Intelligence defect, first ask whether to collect a sanitized
22
+ issue draft; collect nothing before approval and never use telemetry. Include
23
+ only approved CLI/version, expected/actual behavior, and safe error details—
24
+ no confidential or project-specific data. Show the draft and obtain separate
25
+ approval before filing. If declined, ask whether the opt-out is for this
26
+ session, a user/gitignored dev-project profile, or a shared team policy; save
27
+ it only with separate approval. Put team policy in a project-owned rule, and
28
+ never invent a profile path or infer the intended scope.