semantic-atlas 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +59 -43
  2. package/.agents/skills/semantic-atlas/references/graph-patch.md +22 -5
  3. package/.agents/skills/semantic-atlas/references/result-routing.md +32 -19
  4. package/.agents/skills/semantic-atlas/references/snapshot-bootstrap.md +17 -32
  5. package/README.md +34 -20
  6. package/README.zh-CN.md +30 -20
  7. package/dist/cli/argument-parser.js +41 -23
  8. package/dist/cli/bin.js +6 -1
  9. package/dist/cli/cli-application.d.ts +2 -2
  10. package/dist/cli/cli-application.d.ts.map +1 -1
  11. package/dist/cli/cli-application.js +40 -36
  12. package/dist/cli/standalone-cli.d.ts +3 -0
  13. package/dist/cli/standalone-cli.d.ts.map +1 -0
  14. package/dist/cli/standalone-cli.js +65 -0
  15. package/dist/cli/types.d.ts +7 -6
  16. package/dist/cli/types.d.ts.map +1 -1
  17. package/dist/contracts/cli.d.ts +370 -1360
  18. package/dist/contracts/cli.d.ts.map +1 -1
  19. package/dist/contracts/cli.js +58 -65
  20. package/dist/contracts/graph.d.ts +4 -0
  21. package/dist/contracts/graph.d.ts.map +1 -1
  22. package/dist/contracts/graph.js +2 -2
  23. package/dist/evaluation/contracts.d.ts +11 -2
  24. package/dist/evaluation/contracts.d.ts.map +1 -1
  25. package/dist/evaluation/contracts.js +7 -2
  26. package/dist/graph/graph-store.d.ts +3 -1
  27. package/dist/graph/graph-store.d.ts.map +1 -1
  28. package/dist/graph/graph-store.js +48 -2
  29. package/dist/graph/types.d.ts +30 -9
  30. package/dist/graph/types.d.ts.map +1 -1
  31. package/dist/index.d.ts +0 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/package-metadata.d.ts +2 -0
  34. package/dist/package-metadata.d.ts.map +1 -0
  35. package/dist/package-metadata.js +9 -0
  36. package/dist/setup/skill-installer.d.ts +19 -0
  37. package/dist/setup/skill-installer.d.ts.map +1 -0
  38. package/dist/setup/skill-installer.js +156 -0
  39. package/dist/world/business-map-projector.d.ts +14 -0
  40. package/dist/world/business-map-projector.d.ts.map +1 -0
  41. package/dist/world/business-map-projector.js +178 -0
  42. package/dist/world/world-graph-query.d.ts +8 -13
  43. package/dist/world/world-graph-query.d.ts.map +1 -1
  44. package/dist/world/world-graph-query.js +26 -229
  45. package/docs/README.md +30 -0
  46. package/docs/architecture/codegraph-backend.md +2 -2
  47. package/docs/architecture/continuous-business-learning.md +240 -0
  48. package/docs/contracts/cli-v1.md +40 -17
  49. package/docs/contracts/graph-model.md +11 -7
  50. package/docs/contracts/graph-patch-v1.md +8 -1
  51. package/docs/evaluation.md +20 -15
  52. package/docs/index.md +41 -0
  53. package/docs/log.md +56 -0
  54. package/docs/product-contract.md +10 -5
  55. package/package.json +1 -1
  56. package/schemas/cli-envelope-v1.schema.json +365 -564
  57. package/schemas/evaluation-run-v1.schema.json +4 -1
@@ -12,8 +12,14 @@ revision-aware projection that supplies bounded evidence, business context,
12
12
  certainty, validity, and explicit structural limits.
13
13
 
14
14
  The calling Agent owns task interpretation, source changes, tests, Git, and
15
- review. The CLI accepts lexical queries, graph identifiers, snapshot identifiers,
16
- and structured GraphPatch input; it does not interpret natural-language tasks.
15
+ review. The CLI accepts business vocabulary, stable business keys, structural
16
+ search terms, snapshot identifiers, and structured GraphPatch input; it does
17
+ not interpret natural-language tasks.
18
+
19
+ Business knowledge grows during real engineering tasks. Indexing publishes
20
+ structural evidence and refreshes existing assertions; it does not invent an
21
+ upfront business map. A root is any currently parentless business node, and a
22
+ later verified task may place that root beneath a newly discovered parent.
17
23
 
18
24
  ## Required business-understanding loop
19
25
 
@@ -26,15 +32,15 @@ and structured GraphPatch input; it does not interpret natural-language tasks.
26
32
  3. Start with `semantic-atlas status` before broad source discovery. Read the
27
33
  versioned envelope, `data.freshness`, snapshot, warnings, and
28
34
  `data.backend.completeness` by stable fields and codes.
29
- 4. Complete the matching procedure in [Conditional references](#conditional-references)
30
- as soon as the observed status needs indexing or bootstrap.
31
- 5. Query the current map with compact task vocabulary before broad source
32
- search. Let map evidence, owners, candidates, and unknown boundaries define
33
- the initial source seed set.
34
- 6. Classify the map response and complete every triggered reference before
35
- source confirmation. Relevant structural nodes with no relevant business
36
- node trigger snapshot bootstrap; weak, partial, unknown, unsupported, or
37
- otherwise insufficient results trigger result routing.
35
+ 4. Complete the matching snapshot-bootstrap procedure as soon as status reports
36
+ missing, stale, failed, or incomplete publication state.
37
+ 5. Query the business world before broad source search: inspect the world
38
+ `map view`, search compact business vocabulary, then zoom into and show the
39
+ most relevant business region.
40
+ 6. Classify the business response and complete every triggered reference before
41
+ source confirmation. `BUSINESS_KNOWLEDGE_EMPTY`, weak, partial, stale,
42
+ unsupported, or otherwise insufficient business results trigger result
43
+ routing and explicit task-scoped `code search` fallback.
38
44
  7. Open cited ranges and confirm decisive behavior in authoritative source.
39
45
  Follow only the dependencies, interfaces, data, invariants, or tests needed
40
46
  to answer or change the behavior.
@@ -47,23 +53,27 @@ and structured GraphPatch input; it does not interpret natural-language tasks.
47
53
 
48
54
  Extract two to four compact concepts from the task: business vocabulary,
49
55
  likely symbols, interfaces or data, and dependency or impact terms. Query them
50
- in this order as useful:
51
-
52
- 1. Use `semantic-atlas map search <query> [--limit <n>]` for each distinct
53
- lexical concept.
54
- 2. Use `semantic-atlas map show <node-id> [--depth <n>]` on promising business
55
- or structural nodes. Begin at depth 1 and expand to 2 or 3 only for a needed
56
- dependency path.
57
- 3. Use `semantic-atlas map children <node-id>` to descend business `part_of` or
58
- structural `contains` hierarchies.
59
- 4. Use `semantic-atlas map roots` when the task crosses capabilities, the
60
- initial vocabulary is weak, or the current map has no relevant business root.
61
-
62
- When search and roots return relevant structural nodes but no relevant business
63
- node, read snapshot bootstrap before opening source. That state starts the
64
- incremental business-map path rather than the abnormal-result path alone.
65
-
66
- Treat search score as ranking rather than certainty. Stop map traversal when it
56
+ in this order:
57
+
58
+ 1. Run `semantic-atlas map view` to see the current world regions and
59
+ cross-region business connections.
60
+ 2. Use `semantic-atlas map search <business-term> [--limit <n>]` for distinct
61
+ business concepts that are not obvious from the world view.
62
+ 3. Use `semantic-atlas map view <business-key>` to zoom one level at a time.
63
+ Follow `breadcrumbs`, `child` regions, `context` regions, and connection
64
+ summaries until the task's owning business area is visible.
65
+ 4. Use `semantic-atlas map show <business-key>` to inspect the selected
66
+ assertion, its direct business relationships, and direct structural evidence.
67
+ 5. When the map is empty or insufficient, use
68
+ `semantic-atlas code search <structural-term> [--limit <n>]` for likely
69
+ symbols, interfaces, data, or framework entry points. Open the returned
70
+ source locations directly.
71
+
72
+ An empty business world is a normal continuous-learning state. Structural
73
+ results provide a bounded evidence path for the active task and never become a
74
+ second map or substitute business regions.
75
+
76
+ Treat search score as ranking rather than certainty. Stop semantic zoom when it
67
77
  identifies the necessary symbols, files, relationships, evidence, and explicit
68
78
  uncertainty. If the map remains weak, use its best seeds for bounded source
69
79
  inspection and route the observed weak state through the conditional reference.
@@ -81,9 +91,9 @@ certainty, and evidence validity separate:
81
91
  - `stale`, `unknown`, `unsupported`, `partial`, and `insufficient` results bound
82
92
  source fallback rather than authorizing a decisive claim.
83
93
 
84
- Preserve every owner-linked unknown boundary with its reason, location, and
85
- finite candidates. Source inspection may resolve the task while the Atlas
86
- boundary remains honestly unknown.
94
+ When index warnings or source reveal dynamic ambiguity, preserve the unresolved
95
+ boundary in the task conclusion. Source inspection may resolve the current task
96
+ without turning the structural ambiguity into an exact Atlas claim.
87
97
 
88
98
  ## After source changes
89
99
 
@@ -106,29 +116,35 @@ source as authority.
106
116
  Before completing every supported task, classify the business meaning learned
107
117
  during source confirmation:
108
118
 
109
- - Persist every new durable, verified `Capability`, `Scenario`, `Operation`,
110
- `Invariant`, `Interface`, or `Data` concept, plus every supported relationship
111
- between them, when missing or insufficient Atlas knowledge caused the source
112
- inspection.
113
- - Keep transient or unverified observations only in task context. Examples
114
- include debugging symptoms, one-off implementation notes, tentative runtime
115
- paths, Git facts, and hypotheses that lack durable evidence.
116
- - When current Atlas knowledge already expresses the verified business meaning,
117
- reuse it and avoid a duplicate patch.
119
+ - `reuse`: current knowledge already expresses the verified business meaning;
120
+ - `extend`: add a durable, verified `Capability`, `Scenario`, `Operation`,
121
+ `Invariant`, `Interface`, or `Data` concept or supported relationship;
122
+ - `introduce`: create a verified concept as a provisional root when no credible
123
+ parent is known yet;
124
+ - `reparent`: attach an existing node or subtree to a newly verified parent while
125
+ preserving its key, evidence, and non-hierarchy relationships;
126
+ - `refine`: update an existing kind, label, summary, aliases, certainty, or
127
+ evidence when source proves a better assertion;
128
+ - `transient`: keep transient or unverified observations only in task context,
129
+ including symptoms, one-off notes, tentative runtime paths, Git facts, and
130
+ hypotheses without durable evidence.
131
+
132
+ Persist every new durable, verified concept and supported relationship that
133
+ will help a later task. Reuse current knowledge without a duplicate patch when
134
+ it already captures the result.
118
135
 
119
136
  When durable knowledge exists, read GraphPatch authoring, recheck status, submit
120
137
  one atomic patch with `semantic-atlas learn --stdin`, then run
121
138
  `semantic-atlas map show <learned-key>` to verify current validity, certainty,
122
139
  evidence, and relationships. The verified node must be reusable by a later
123
- fresh task through normal map search and traversal.
140
+ fresh task through world view, business search, semantic zoom, and direct show.
124
141
 
125
142
  ## Conditional references
126
143
 
127
144
  Load detailed procedures only after their matching observable state:
128
145
 
129
146
  - Read [snapshot bootstrap](references/snapshot-bootstrap.md) only when status
130
- reports `missing`, `stale`, or incomplete state; a current map has no relevant
131
- business knowledge; or the user explicitly requests project initialization.
147
+ reports `missing`, `stale`, failed, or incomplete state.
132
148
  - Read [result routing](references/result-routing.md) only when a command returns
133
149
  an error, warning, `hypothesis`, `unknown`, `unsupported`, `partial`, empty,
134
150
  competing, or otherwise `insufficient` result.
@@ -99,9 +99,11 @@ Node kinds:
99
99
  - `Interface`: an API, event, queue, or integration contract;
100
100
  - `Data`: a business data concept or persisted record.
101
101
 
102
- Use stable lowercase hierarchical keys such as
103
- `<domain>/<capability>/<concept>`. Labels and aliases provide vocabulary;
104
- summaries state evidence-bound assertions.
102
+ Use stable lowercase slash-separated keys such as
103
+ `<namespace>/<concept>`. A key is durable vocabulary identity; its readable
104
+ namespace does not define its hierarchy. Labels and aliases provide vocabulary,
105
+ summaries state evidence-bound assertions, and `part_of` alone defines current
106
+ placement. Preserve a node's key when its parent changes.
105
107
 
106
108
  Business relation types:
107
109
 
@@ -120,6 +122,19 @@ Every learned relation originates at a business node.
120
122
  - A structural target is `{ "domain": "structural", "id": "symbol:..." }` or
121
123
  a current `test:...` declaration ID.
122
124
 
125
+ ## Hierarchy and reparenting
126
+
127
+ Any business node kind may be a provisional root while no verified parent is
128
+ known. Each node has at most one outgoing `part_of` parent, and the complete
129
+ `part_of` graph remains acyclic.
130
+
131
+ When later work verifies a different or broader parent, submit one patch that
132
+ can upsert the parent, remove the old `part_of`, and upsert the new `part_of`.
133
+ Keep the moved node and descendants unchanged so their keys, evidence, and
134
+ non-hierarchy relationships remain reusable. Atlas validates the final graph
135
+ after removals and rejects the whole patch when it would create a second parent
136
+ or a cycle.
137
+
123
138
  ## Evidence
124
139
 
125
140
  Every upserted node summary and relation includes at least one evidence item:
@@ -136,7 +151,8 @@ Every upserted node summary and relation includes at least one evidence item:
136
151
  }
137
152
  ```
138
153
 
139
- Copy structural identity, path, range, and hash from a current Atlas map result.
154
+ Copy structural identity, path, range, and hash from a current `code search` or
155
+ direct `map show` evidence result.
140
156
  Atlas validates that the symbol resolves, path and range match, and file hash is
141
157
  current. Evidence outside the worktree or fabricated from source text is not a
142
158
  valid binding.
@@ -170,4 +186,5 @@ partially replaying operations.
170
186
 
171
187
  After success, inspect the returned operation counts and run `map show` for the
172
188
  learned key. Confirm its certainty, `valid` status, evidence, and intended
173
- relationships before relying on it in later tasks.
189
+ relationships, then use `map view` at the world and parent levels to confirm its
190
+ placement before relying on it in later tasks.
@@ -34,33 +34,46 @@ individually.
34
34
 
35
35
  ## Query results
36
36
 
37
+ ### Empty business knowledge
38
+
39
+ `BUSINESS_KNOWLEDGE_EMPTY` with `data.command: "map.view"` and `regions: []`
40
+ means the structural snapshot is usable but no verified business node has been
41
+ learned yet. Treat it as a normal task-driven learning state:
42
+
43
+ 1. Confirm the world view is empty, then run `code search` with the active
44
+ task's likely symbols, interfaces, data names, or framework entry points.
45
+ 2. Inspect only the structural relationships and source ranges needed for the
46
+ current engineering task.
47
+ 3. Complete and verify the engineering work with source as authority.
48
+ 4. At knowledge capture, introduce durable verified concepts as provisional
49
+ roots or attach them to any parent established during the task.
50
+
51
+ Structural nodes remain source-navigation evidence and never substitute for
52
+ business regions.
53
+
37
54
  ### Empty or weak search
38
55
 
39
- 1. Reduce the task to business vocabulary, exact symbol fragments, paths,
40
- interface names, data names, and framework-owned terms.
41
- 2. Try up to two materially different lexical formulations rather than many
42
- cosmetic variants.
43
- 3. Inspect `map roots` and the closest owning hierarchy.
44
- 4. Use any returned locations as bounded source seeds.
45
- 5. Classify the map as `insufficient` for this task when no relevant node or
46
- relationship emerges, then switch to bounded source fallback.
56
+ 1. Reduce the task to business vocabulary and try up to two materially
57
+ different `map search` formulations.
58
+ 2. Inspect the world `map view`, then zoom through the closest owning hierarchy
59
+ when a relevant region exists.
60
+ 3. Classify the business map as `insufficient` when no relevant node or
61
+ relationship emerges.
62
+ 4. Run up to two materially different `code search` formulations using exact
63
+ symbol fragments, interface names, data names, paths, or framework terms.
64
+ 5. Use returned source locations as the bounded fallback seed set.
47
65
 
48
66
  Lexical scores rank results only. A high score does not establish correctness,
49
67
  certainty, or business meaning.
50
68
 
51
69
  ### Unknown and ambiguity
52
70
 
53
- For every `UnknownBoundary`, retain:
54
-
55
- - its structural owner;
56
- - unresolved operation and reason;
57
- - source location;
58
- - finite candidate list;
59
- - structural support status and provenance.
60
-
61
- Inspect the owner and candidates in source. Promote a relationship in the
62
- Agent's conclusion only when the execution or assignment path is uniquely
63
- established. Preserve the boundary when multiple candidates remain plausible.
71
+ An `UNKNOWN_BOUNDARY` warning means the structural index detected unresolved
72
+ runtime or language behavior. Use `code search` to locate the task-relevant
73
+ owner and inspect the execution or assignment path in source. Promote a
74
+ relationship in the Agent's conclusion only when source establishes it
75
+ uniquely; preserve the ambiguity and any finite candidates discovered in source
76
+ when multiple targets remain plausible.
64
77
 
65
78
  ### Stale assertions
66
79
 
@@ -1,8 +1,7 @@
1
- # Snapshot and business-map bootstrap
1
+ # Snapshot publication
2
2
 
3
3
  Read this reference after the required `status` call shows that the structural
4
- snapshot needs publication, or after a current map proves that relevant
5
- business knowledge is absent. Keep all commands serialized in the exact target
4
+ snapshot needs publication. Keep all commands serialized in the exact target
6
5
  worktree.
7
6
 
8
7
  ## Publish structural state
@@ -15,43 +14,29 @@ worktree.
15
14
  command performs the initial full index.
16
15
  2. Run `semantic-atlas status` again. Continue with Atlas only when freshness is
17
16
  `current` and backend completeness is `complete`.
18
- 3. Run `semantic-atlas map roots`. Structural `Module` roots are valid initial
19
- navigation when no business `Capability` root exists.
17
+ 3. Run `semantic-atlas map view`. It returns current parentless business nodes
18
+ as world regions. An empty `regions` array with `BUSINESS_KNOWLEDGE_EMPTY`
19
+ means no task has established reusable business knowledge yet.
20
20
  4. Use source as authority while publication is unavailable. Read result routing
21
21
  when the index or follow-up status contains warnings or errors.
22
22
 
23
- ## Bootstrap during a normal task
23
+ ## Continue into the normal task
24
24
 
25
25
  A normal task grows only the business area it actually verifies:
26
26
 
27
- 1. Search task vocabulary and inspect the closest structural owner, neighbors,
28
- and finite unknown candidates.
27
+ 1. Inspect the world view and search task business vocabulary. When business
28
+ knowledge is empty or irrelevant, use `code search` for bounded structural
29
+ owners and source locations.
29
30
  2. Open the bounded source path required by the task and confirm the decisive
30
31
  behavior.
31
32
  3. Identify each durable business concept and relationship that the source now
32
33
  proves but the current map lacks.
33
34
  4. Follow GraphPatch authoring, submit those verified facts together, and verify
34
- each learned entry through `semantic-atlas map show`.
35
- 5. Stop after the task-relevant capability is reusable. Leave unrelated roots
36
- for later tasks.
37
-
38
- ## Bootstrap an explicitly requested project map
39
-
40
- Treat project initialization as a bounded mapping task rather than an attempt
41
- to describe every symbol:
42
-
43
- 1. Begin with `semantic-atlas map roots` and select the requested directories,
44
- domains, or a small set of the most evidence-rich structural roots when the
45
- request supplies no narrower boundary.
46
- 2. For each selected root, follow one representative path through public
47
- interfaces, operations, data, invariants, and verification where present.
48
- 3. Confirm the controlling declarations in source and record the initialization
49
- boundary in the task result.
50
- 4. Learn only durable verified capabilities and their supported child concepts
51
- and relationships. Preserve unknown or unsupported behavior as boundaries,
52
- not exact business facts.
53
- 5. Verify learned capability keys with `semantic-atlas map show`, then start a
54
- fresh query from one learned term to prove the initial map is reusable.
55
-
56
- Future tasks extend this initial map incrementally as they verify more business
57
- behavior.
35
+ each learned entry through `semantic-atlas map show`, then confirm its
36
+ placement through `semantic-atlas map view`.
37
+ 5. Stop after the task-relevant business area is reusable. Let later engineering
38
+ tasks expand or reorganize the map as they verify more behavior.
39
+
40
+ Empty business knowledge routes to bounded structural and source inspection for
41
+ the active task. The resulting source evidence may introduce a provisional root;
42
+ a later task can reparent it when a broader business concept becomes verified.
package/README.md CHANGED
@@ -38,6 +38,13 @@ Source code remains authoritative. Atlas is a revision-aware projection that mak
38
38
 
39
39
  ![Semantic Atlas capability map showing structural evidence, business knowledge, the Agent loop, one unified world map, explicit uncertainty, and local storage](docs/mindmaps/semantic-atlas-overview.png)
40
40
 
41
+ Atlas stores one canonical business graph rather than separate overview and
42
+ detail maps. `map view` shows its current visible frontier: start at parentless
43
+ world regions, zoom into a business key, follow breadcrumbs and related context
44
+ regions, and keep zooming until the relevant operation, data, or rule is visible.
45
+ Cross-region connections summarize the verified deeper relations that contribute
46
+ to the current view without persisting invented high-level facts.
47
+
41
48
  ## Quick start
42
49
 
43
50
  Semantic Atlas supports Node.js 22.12 through 24 and Git worktrees containing TypeScript or JavaScript.
@@ -46,20 +53,19 @@ Semantic Atlas supports Node.js 22.12 through 24 and Git worktrees containing Ty
46
53
 
47
54
  ```sh
48
55
  npm install --global semantic-atlas
56
+ semantic-atlas setup
57
+ semantic-atlas --version
49
58
  semantic-atlas status --repo /path/to/project
50
59
  ```
51
60
 
52
- After installation, indexing and queries run locally without model or network calls. npm registry access is needed only to install the package.
53
-
54
- ### Install the Codex Skill
61
+ `setup` installs the exact Skill bundled with the current package into
62
+ `~/.agents/skills/semantic-atlas`. Run it again after upgrading the npm package
63
+ to update the managed Skill. It also removes a recognized legacy copy from
64
+ `~/.codex/skills/semantic-atlas`, preventing an older duplicate from taking
65
+ precedence. Codex and other compatible agents can then select `$semantic-atlas`
66
+ from the task description, or you can invoke it explicitly.
55
67
 
56
- Install the Skill from the repository's current `main` branch:
57
-
58
- ```text
59
- $skill-installer Install semantic-atlas from https://github.com/lzj960515/semantic-atlas/tree/main/.agents/skills/semantic-atlas
60
- ```
61
-
62
- Codex can then select `$semantic-atlas` from the task description, or you can invoke it explicitly.
68
+ After installation, indexing and queries run locally without model or network calls. npm registry access is needed only to install or update the package.
63
69
 
64
70
  ### Run the first query
65
71
 
@@ -68,23 +74,31 @@ Run commands serially from the exact target worktree:
68
74
  ```sh
69
75
  semantic-atlas status
70
76
  semantic-atlas index
71
- semantic-atlas map roots
77
+ semantic-atlas map view
72
78
  semantic-atlas map search "checkout" --limit 10
73
- semantic-atlas map show module:src --depth 1
79
+ semantic-atlas code search "CheckoutService" --limit 10
74
80
  ```
75
81
 
76
- Every command writes one versioned JSON envelope to standard output. Diagnostics stay on standard error, so agents consume stable fields and warning codes instead of scraping prose.
82
+ Every project command writes one versioned JSON envelope to standard output.
83
+ `setup`, `-h`/`--help`, and `--version` are repository-independent text
84
+ commands. Diagnostics stay on standard error, so agents consume stable project
85
+ fields and warning codes instead of scraping prose.
86
+
87
+ On a newly indexed project, the world `map view` may return `regions: []` with
88
+ `BUSINESS_KNOWLEDGE_EMPTY`. That is the honest starting state: map commands
89
+ contain business knowledge only, while explicit `code search` provides bounded
90
+ CodeGraph evidence for the active task.
77
91
 
78
92
  ## The Agent loop
79
93
 
80
94
  1. **Status.** Confirm the exact repository root, snapshot freshness, and structural-backend completeness before broad source discovery.
81
95
  2. **Index.** Publish or refresh the worktree-local snapshot when state is missing, stale, failed, or incomplete.
82
- 3. **Query.** Search compact business and symbol vocabulary, then traverse only the promising nodes and relationships.
96
+ 3. **Query.** Start from the business world, search business vocabulary, zoom through relevant regions, and show direct evidence. Use `code search` only when the business map is absent or insufficient.
83
97
  4. **Confirm source.** Open the cited ranges and resolve the decisive behavior in authoritative code. Keep partial, stale, unsupported, and unknown results bounded.
84
98
  5. **Do the engineering work.** The calling agent edits code, runs tests, reviews diffs, and owns Git; Atlas performs none of those actions.
85
99
  6. **Reconcile and learn.** Reindex after relevant source changes, inspect semantic `changes`, and submit only durable, verified business knowledge through `learn --stdin`. Verify learned nodes with `map show`.
86
100
 
87
- This loop grows the business map one verified capability at a time. It does not attempt to convert the whole repository into speculative documentation.
101
+ This loop grows and reorganizes the business map one verified business area at a time. A parentless operation can be a provisional root; later work can place it beneath a broader concept without changing its stable key or evidence. Atlas does not require an upfront repository-wide business-learning pass.
88
102
 
89
103
  When `index` runs for a newly created Git worktree, Atlas automatically copies a compatible sibling CodeGraph projection and performs an incremental sync. Agents do not run a separate initialization command; a full index is used only when no compatible sibling projection is available.
90
104
 
@@ -111,7 +125,7 @@ These are fixture-scoped comparative results. They do **not** establish universa
111
125
  An isolated TypeScript project was used to validate the public installation path with the registry-installed CLI and the Skill from this repository:
112
126
 
113
127
  - A first fresh agent completed `missing → index → query → source confirmation → learn`.
114
- - A second fresh agent discovered and reused the persisted knowledge through normal `status`, search, roots, and show commands without receiving the previous answer or repeating `learn`.
128
+ - A second fresh agent discovered and reused the persisted knowledge through normal status, business navigation, search, and show commands without receiving the previous answer or repeating `learn`.
115
129
  - The target revision and ordinary Git status stayed unchanged; durable knowledge lived in the user Atlas home and the worktree contained only ignored CodeGraph state.
116
130
 
117
131
  This validates installation, the Agent workflow, knowledge reuse, and zero-intrusion behavior in that project. It is not a universal accuracy benchmark or a production-stability claim.
@@ -133,10 +147,10 @@ This validates installation, the Agent workflow, knowledge reuse, and zero-intru
133
147
  ```text
134
148
  semantic-atlas status [--repo <path>] [--pretty]
135
149
  semantic-atlas index [--repo <path>] [--pretty]
136
- semantic-atlas map roots [--repo <path>] [--pretty]
137
- semantic-atlas map search <query> [--limit <n>] [--repo <path>] [--pretty]
138
- semantic-atlas map children <node-id> [--repo <path>] [--pretty]
139
- semantic-atlas map show <node-id> [--depth <n>] [--repo <path>] [--pretty]
150
+ semantic-atlas map view [business-key] [--repo <path>] [--pretty]
151
+ semantic-atlas map search <business-term> [--limit <n>] [--repo <path>] [--pretty]
152
+ semantic-atlas map show <business-key> [--repo <path>] [--pretty]
153
+ semantic-atlas code search <structural-term> [--limit <n>] [--repo <path>] [--pretty]
140
154
  semantic-atlas learn --stdin [--repo <path>] [--pretty]
141
155
  semantic-atlas changes [--from <snapshot-id>] [--to <snapshot-id>] [--repo <path>] [--pretty]
142
156
  ```
package/README.zh-CN.md CHANGED
@@ -38,6 +38,12 @@ Semantic Atlas 为编程 Agent 提供一张本地世界图,把两类项目知
38
38
 
39
39
  ![Semantic Atlas 能力图,展示结构证据、业务知识、Agent 循环、统一世界图、显式不确定性与本地存储](docs/mindmaps/semantic-atlas-overview.zh-CN.png)
40
40
 
41
+ Atlas 保存一张权威业务图,而不是分别保存总览图和多张细节图。`map view`
42
+ 展示它在当前缩放层级的可见边界:先看没有父节点的世界区域,再进入某个业务
43
+ key,沿 breadcrumb、子区域和关联上下文区域继续放大,直到看见任务相关的
44
+ 操作、数据或规则。跨区域连接汇总支撑当前视图的深层已验证关系,但不会把
45
+ 投影出来的高层关系持久化成新事实。
46
+
41
47
  ## 快速开始
42
48
 
43
49
  Semantic Atlas 支持 Node.js 22.12 至 24,以及包含 TypeScript 或 JavaScript 的 Git 工作树。
@@ -46,20 +52,18 @@ Semantic Atlas 支持 Node.js 22.12 至 24,以及包含 TypeScript 或 JavaScr
46
52
 
47
53
  ```sh
48
54
  npm install --global semantic-atlas
55
+ semantic-atlas setup
56
+ semantic-atlas --version
49
57
  semantic-atlas status --repo /path/to/project
50
58
  ```
51
59
 
52
- 安装完成后,索引和查询均在本机执行,不会调用模型或网络。只有安装软件包时需要正常访问 npm registry。
53
-
54
- ### 安装 Codex Skill
60
+ `setup` 会把当前 npm 包内的同版本 Skill 安装到
61
+ `~/.agents/skills/semantic-atlas`。升级 npm 包后再次执行即可同步 Skill;它还会
62
+ 删除能够确认为 Semantic Atlas 的旧 `~/.codex/skills/semantic-atlas` 副本,避免
63
+ 旧版本优先被发现。之后,Codex 和其他兼容 Agent 可以根据任务描述自动选择
64
+ `$semantic-atlas`,你也可以显式调用它。
55
65
 
56
- 从仓库当前的 `main` 分支安装 Skill:
57
-
58
- ```text
59
- $skill-installer Install semantic-atlas from https://github.com/lzj960515/semantic-atlas/tree/main/.agents/skills/semantic-atlas
60
- ```
61
-
62
- 之后,Codex 可以根据任务描述自动选择 `$semantic-atlas`,你也可以显式调用它。
66
+ 安装完成后,索引和查询均在本机执行,不会调用模型或网络。只有安装或更新软件包时需要正常访问 npm registry。
63
67
 
64
68
  ### 发起第一次查询
65
69
 
@@ -68,23 +72,29 @@ $skill-installer Install semantic-atlas from https://github.com/lzj960515/semant
68
72
  ```sh
69
73
  semantic-atlas status
70
74
  semantic-atlas index
71
- semantic-atlas map roots
75
+ semantic-atlas map view
72
76
  semantic-atlas map search "checkout" --limit 10
73
- semantic-atlas map show module:src --depth 1
77
+ semantic-atlas code search "CheckoutService" --limit 10
74
78
  ```
75
79
 
76
- 每条命令都会向标准输出写入一个带版本的 JSON 信封。诊断信息留在标准错误中,因此 Agent 可以读取稳定字段与告警代码,而不是抓取自然语言文本。
80
+ 每条项目命令都会向标准输出写入一个带版本的 JSON 信封;`setup`、
81
+ `-h`/`--help` 与 `--version` 是不依赖仓库的文本命令。诊断信息留在标准错误
82
+ 中,因此 Agent 可以读取稳定的项目字段与告警代码,而不是抓取自然语言文本。
83
+
84
+ 新项目完成索引后,世界 `map view` 可能返回 `regions: []` 和
85
+ `BUSINESS_KNOWLEDGE_EMPTY`。这是诚实的起点:map 命令只包含已经验证的业务
86
+ 知识,显式 `code search` 则为当前任务提供有边界的 CodeGraph 证据。
77
87
 
78
88
  ## Agent 如何循环工作?
79
89
 
80
90
  1. **检查状态。** 在广泛发现源码前,确认准确的仓库根目录、快照新鲜度和结构后端完整性。
81
91
  2. **建立索引。** 当状态缺失、过期、失败或不完整时,发布或刷新当前工作树的本地快照。
82
- 3. **查询世界图。** 搜索精简的业务词和符号词,只沿有希望的节点与关系继续遍历。
92
+ 3. **查询世界图。** 从业务世界开始,搜索业务词、逐层缩放相关区域并查看直接证据;只有业务地图为空或不足时才使用 `code search`。
83
93
  4. **确认源码。** 打开图中引用的范围,在权威代码中确认决定性行为;让部分、过期、不支持和未知结果保持有边界。
84
94
  5. **完成工程工作。** 调用 Agent 负责改代码、跑测试、审查差异和操作 Git;Atlas 不接管这些动作。
85
95
  6. **对齐并学习。** 相关源码变化后重新索引,检查语义 `changes`,只通过 `learn --stdin` 写入持久且已验证的业务知识,再用 `map show` 验证学习结果。
86
96
 
87
- 这个循环每次只增长一块经过验证的业务能力,而不是把整个仓库转换成推测性文档。
97
+ 这个循环在真实任务中逐块增长并重组经过验证的业务地图。一个暂时没有已知父节点的操作可以先成为根;后续任务发现更大的业务概念后,可以保持原有 key 和证据,把它挂到新的父节点下。Atlas 不要求预先执行一次全仓库业务学习。
88
98
 
89
99
  当新建 Git worktree 第一次运行 `index` 时,Atlas 会自动复制兼容 sibling worktree 的 CodeGraph 投影,再执行增量同步。Agent 不需要额外初始化命令;只有不存在兼容投影时才执行全量索引。
90
100
 
@@ -111,7 +121,7 @@ semantic-atlas map show module:src --depth 1
111
121
  我们在一个隔离的 TypeScript 项目中,使用从 npm registry 安装的 CLI 和本仓库公开的 Skill 验证了公开安装路径:
112
122
 
113
123
  - 第一个全新 Agent 完成 `missing → index → query → 源码确认 → learn`。
114
- - 第二个全新 Agent 没有看到前一个答案,也没有重复 `learn`,只通过正常的 `status`、搜索、根节点和详情查询就发现并复用了已持久化的知识。
124
+ - 第二个全新 Agent 没有看到前一个答案,也没有重复 `learn`,只通过正常的状态、业务导航、搜索和详情查询就发现并复用了已持久化的知识。
115
125
  - 验证前后,目标 revision 与普通 Git 状态保持不变;持久知识位于用户级 Atlas 目录,工作树内只有被忽略的 CodeGraph 状态。
116
126
 
117
127
  这次验证说明安装路径、Agent 工作流、知识复用和零侵入行为可以协同工作;它不构成通用准确率基准或生产稳定性结论。
@@ -133,10 +143,10 @@ semantic-atlas map show module:src --depth 1
133
143
  ```text
134
144
  semantic-atlas status [--repo <path>] [--pretty]
135
145
  semantic-atlas index [--repo <path>] [--pretty]
136
- semantic-atlas map roots [--repo <path>] [--pretty]
137
- semantic-atlas map search <query> [--limit <n>] [--repo <path>] [--pretty]
138
- semantic-atlas map children <node-id> [--repo <path>] [--pretty]
139
- semantic-atlas map show <node-id> [--depth <n>] [--repo <path>] [--pretty]
146
+ semantic-atlas map view [business-key] [--repo <path>] [--pretty]
147
+ semantic-atlas map search <business-term> [--limit <n>] [--repo <path>] [--pretty]
148
+ semantic-atlas map show <business-key> [--repo <path>] [--pretty]
149
+ semantic-atlas code search <structural-term> [--limit <n>] [--repo <path>] [--pretty]
140
150
  semantic-atlas learn --stdin [--repo <path>] [--pretty]
141
151
  semantic-atlas changes [--from <snapshot-id>] [--to <snapshot-id>] [--repo <path>] [--pretty]
142
152
  ```