semantic-atlas 0.1.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.
- package/.agents/skills/semantic-atlas/SKILL.md +172 -0
- package/.agents/skills/semantic-atlas/references/graph-patch.md +109 -0
- package/.agents/skills/semantic-atlas/references/result-routing.md +91 -0
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/dist/business-flow/business-flow-derivation-service.d.ts +11 -0
- package/dist/business-flow/business-flow-derivation-service.d.ts.map +1 -0
- package/dist/business-flow/business-flow-derivation-service.js +151 -0
- package/dist/business-flow/business-flow-draft.d.ts +16 -0
- package/dist/business-flow/business-flow-draft.d.ts.map +1 -0
- package/dist/business-flow/business-flow-draft.js +150 -0
- package/dist/business-flow/framework-business-strategy.d.ts +7 -0
- package/dist/business-flow/framework-business-strategy.d.ts.map +1 -0
- package/dist/business-flow/framework-business-strategy.js +1 -0
- package/dist/business-flow/strategies/bullmq-business-strategy.d.ts +10 -0
- package/dist/business-flow/strategies/bullmq-business-strategy.d.ts.map +1 -0
- package/dist/business-flow/strategies/bullmq-business-strategy.js +79 -0
- package/dist/business-flow/strategies/called-operation-derivation.d.ts +13 -0
- package/dist/business-flow/strategies/called-operation-derivation.d.ts.map +1 -0
- package/dist/business-flow/strategies/called-operation-derivation.js +32 -0
- package/dist/business-flow/strategies/graphql-business-strategy.d.ts +8 -0
- package/dist/business-flow/strategies/graphql-business-strategy.d.ts.map +1 -0
- package/dist/business-flow/strategies/graphql-business-strategy.js +65 -0
- package/dist/business-flow/strategies/nestjs-business-strategy.d.ts +8 -0
- package/dist/business-flow/strategies/nestjs-business-strategy.d.ts.map +1 -0
- package/dist/business-flow/strategies/nestjs-business-strategy.js +72 -0
- package/dist/business-flow/strategies/strategy-helpers.d.ts +32 -0
- package/dist/business-flow/strategies/strategy-helpers.d.ts.map +1 -0
- package/dist/business-flow/strategies/strategy-helpers.js +49 -0
- package/dist/business-flow/strategies/typeorm-business-strategy.d.ts +10 -0
- package/dist/business-flow/strategies/typeorm-business-strategy.d.ts.map +1 -0
- package/dist/business-flow/strategies/typeorm-business-strategy.js +136 -0
- package/dist/business-flow/strategies/verified-invariant-strategy.d.ts +5 -0
- package/dist/business-flow/strategies/verified-invariant-strategy.d.ts.map +1 -0
- package/dist/business-flow/strategies/verified-invariant-strategy.js +38 -0
- package/dist/business-flow/strategies/verified-test-strategy.d.ts +5 -0
- package/dist/business-flow/strategies/verified-test-strategy.d.ts.map +1 -0
- package/dist/business-flow/strategies/verified-test-strategy.js +26 -0
- package/dist/business-flow/structural-flow-catalog.d.ts +21 -0
- package/dist/business-flow/structural-flow-catalog.d.ts.map +1 -0
- package/dist/business-flow/structural-flow-catalog.js +125 -0
- package/dist/business-flow/types.d.ts +51 -0
- package/dist/business-flow/types.d.ts.map +1 -0
- package/dist/business-flow/types.js +1 -0
- package/dist/cli/argument-parser.d.ts +3 -0
- package/dist/cli/argument-parser.d.ts.map +1 -0
- package/dist/cli/argument-parser.js +174 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +23 -0
- package/dist/cli/cli-application.d.ts +38 -0
- package/dist/cli/cli-application.d.ts.map +1 -0
- package/dist/cli/cli-application.js +515 -0
- package/dist/cli/cli-error.d.ts +12 -0
- package/dist/cli/cli-error.d.ts.map +1 -0
- package/dist/cli/cli-error.js +44 -0
- package/dist/cli/cli-presenter.d.ts +14 -0
- package/dist/cli/cli-presenter.d.ts.map +1 -0
- package/dist/cli/cli-presenter.js +36 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +45 -0
- package/dist/cli/types.d.ts +46 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +1 -0
- package/dist/contracts/cli.d.ts +2139 -0
- package/dist/contracts/cli.d.ts.map +1 -0
- package/dist/contracts/cli.js +232 -0
- package/dist/contracts/graph.d.ts +262 -0
- package/dist/contracts/graph.d.ts.map +1 -0
- package/dist/contracts/graph.js +182 -0
- package/dist/contracts/identifiers.d.ts +4 -0
- package/dist/contracts/identifiers.d.ts.map +1 -0
- package/dist/contracts/identifiers.js +7 -0
- package/dist/contracts/public-contracts.d.ts +4 -0
- package/dist/contracts/public-contracts.d.ts.map +1 -0
- package/dist/contracts/public-contracts.js +3 -0
- package/dist/evaluation/comparison.d.ts +30 -0
- package/dist/evaluation/comparison.d.ts.map +1 -0
- package/dist/evaluation/comparison.js +108 -0
- package/dist/evaluation/contracts.d.ts +204 -0
- package/dist/evaluation/contracts.d.ts.map +1 -0
- package/dist/evaluation/contracts.js +269 -0
- package/dist/graph/graph-store.d.ts +47 -0
- package/dist/graph/graph-store.d.ts.map +1 -0
- package/dist/graph/graph-store.js +719 -0
- package/dist/graph/types.d.ts +168 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/knowledge/business-knowledge-service.d.ts +24 -0
- package/dist/knowledge/business-knowledge-service.d.ts.map +1 -0
- package/dist/knowledge/business-knowledge-service.js +200 -0
- package/dist/knowledge/graph-patch-conflict-error.d.ts +8 -0
- package/dist/knowledge/graph-patch-conflict-error.d.ts.map +1 -0
- package/dist/knowledge/graph-patch-conflict-error.js +12 -0
- package/dist/knowledge/structural-target-binding.d.ts +14 -0
- package/dist/knowledge/structural-target-binding.d.ts.map +1 -0
- package/dist/knowledge/structural-target-binding.js +11 -0
- package/dist/repository/git-command.d.ts +3 -0
- package/dist/repository/git-command.d.ts.map +1 -0
- package/dist/repository/git-command.js +25 -0
- package/dist/repository/repository-inspector.d.ts +7 -0
- package/dist/repository/repository-inspector.d.ts.map +1 -0
- package/dist/repository/repository-inspector.js +84 -0
- package/dist/repository/repository-language-support.d.ts +14 -0
- package/dist/repository/repository-language-support.d.ts.map +1 -0
- package/dist/repository/repository-language-support.js +64 -0
- package/dist/repository/types.d.ts +9 -0
- package/dist/repository/types.d.ts.map +1 -0
- package/dist/repository/types.js +1 -0
- package/dist/snapshots/repository-snapshot.d.ts +4 -0
- package/dist/snapshots/repository-snapshot.d.ts.map +1 -0
- package/dist/snapshots/repository-snapshot.js +119 -0
- package/dist/snapshots/types.d.ts +30 -0
- package/dist/snapshots/types.d.ts.map +1 -0
- package/dist/snapshots/types.js +1 -0
- package/dist/storage/atlas-database.d.ts +14 -0
- package/dist/storage/atlas-database.d.ts.map +1 -0
- package/dist/storage/atlas-database.js +552 -0
- package/dist/storage/snapshot-store.d.ts +19 -0
- package/dist/storage/snapshot-store.d.ts.map +1 -0
- package/dist/storage/snapshot-store.js +77 -0
- package/dist/structural-backend/codegraph-backend.d.ts +54 -0
- package/dist/structural-backend/codegraph-backend.d.ts.map +1 -0
- package/dist/structural-backend/codegraph-backend.js +1224 -0
- package/dist/structural-backend/codegraph-worker-client.d.ts +5 -0
- package/dist/structural-backend/codegraph-worker-client.d.ts.map +1 -0
- package/dist/structural-backend/codegraph-worker-client.js +118 -0
- package/dist/structural-backend/codegraph-worker-protocol.d.ts +35 -0
- package/dist/structural-backend/codegraph-worker-protocol.d.ts.map +1 -0
- package/dist/structural-backend/codegraph-worker-protocol.js +1 -0
- package/dist/structural-backend/codegraph-worker.d.ts +2 -0
- package/dist/structural-backend/codegraph-worker.d.ts.map +1 -0
- package/dist/structural-backend/codegraph-worker.js +131 -0
- package/dist/structural-backend/process-instance.d.ts +18 -0
- package/dist/structural-backend/process-instance.d.ts.map +1 -0
- package/dist/structural-backend/process-instance.js +207 -0
- package/dist/structural-backend/structural-fact-changes.d.ts +7 -0
- package/dist/structural-backend/structural-fact-changes.d.ts.map +1 -0
- package/dist/structural-backend/structural-fact-changes.js +78 -0
- package/dist/structural-backend/structural-publication.d.ts +12 -0
- package/dist/structural-backend/structural-publication.d.ts.map +1 -0
- package/dist/structural-backend/structural-publication.js +252 -0
- package/dist/structural-backend/structural-write-lock.d.ts +8 -0
- package/dist/structural-backend/structural-write-lock.d.ts.map +1 -0
- package/dist/structural-backend/structural-write-lock.js +415 -0
- package/dist/structural-backend/types.d.ts +144 -0
- package/dist/structural-backend/types.d.ts.map +1 -0
- package/dist/structural-backend/types.js +11 -0
- package/dist/world/types.d.ts +77 -0
- package/dist/world/types.d.ts.map +1 -0
- package/dist/world/types.js +1 -0
- package/dist/world/world-graph-query.d.ts +31 -0
- package/dist/world/world-graph-query.d.ts.map +1 -0
- package/dist/world/world-graph-query.js +453 -0
- package/dist/world/world-model-service.d.ts +21 -0
- package/dist/world/world-model-service.d.ts.map +1 -0
- package/dist/world/world-model-service.js +211 -0
- package/dist/world/world-snapshot-store.d.ts +40 -0
- package/dist/world/world-snapshot-store.d.ts.map +1 -0
- package/dist/world/world-snapshot-store.js +555 -0
- package/docs/architecture/codegraph-backend.md +193 -0
- package/docs/contracts/cli-v1.md +119 -0
- package/docs/contracts/graph-model.md +102 -0
- package/docs/contracts/graph-patch-v1.md +98 -0
- package/docs/evaluation.md +128 -0
- package/docs/product-contract.md +148 -0
- package/package.json +78 -0
- package/schemas/cli-envelope-v1.schema.json +1359 -0
- package/schemas/evaluation-plan-v1.schema.json +211 -0
- package/schemas/evaluation-run-v1.schema.json +365 -0
- package/schemas/graph-patch-v1.schema.json +392 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: semantic-atlas
|
|
3
|
+
description: "Use Semantic Atlas for evidence-bound project understanding and impact analysis in TypeScript or JavaScript repositories: locate business capabilities and implementations, trace dependencies, inspect invariants and tests, assess semantic changes, and preserve verified business knowledge. Use when a repository has the semantic-atlas CLI or a local Atlas map; route source editing, testing, Git, and review to normal engineering workflows."
|
|
4
|
+
compatibility: "Requires Node.js 22.12 through 24 and the semantic-atlas CLI."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Semantic Atlas
|
|
8
|
+
|
|
9
|
+
Use the local, deterministic Atlas world map as the first project-understanding
|
|
10
|
+
surface. Source code remains authoritative; Atlas data is a revision-aware
|
|
11
|
+
projection that supplies bounded context, evidence, certainty, validity, and
|
|
12
|
+
explicit structural limits.
|
|
13
|
+
|
|
14
|
+
The calling Agent owns concept extraction and natural-language reasoning. The
|
|
15
|
+
CLI accepts lexical terms, graph identifiers, snapshot identifiers, and a
|
|
16
|
+
structured GraphPatch; it does not interpret a natural-language task.
|
|
17
|
+
|
|
18
|
+
Run one Atlas CLI command at a time within a worktree and wait for its complete
|
|
19
|
+
response before starting the next command. The worktree-local database and
|
|
20
|
+
publication lifecycle are a serialized evidence boundary; parallel status,
|
|
21
|
+
index, map, changes, or learn calls can observe transient publication state.
|
|
22
|
+
|
|
23
|
+
## First use
|
|
24
|
+
|
|
25
|
+
1. Identify the exact target Git worktree. Keep all commands scoped to that
|
|
26
|
+
worktree with the current directory or `--repo <path>`.
|
|
27
|
+
2. Run `semantic-atlas status` and parse the versioned JSON envelope. Use fields
|
|
28
|
+
such as `status`, `data.freshness`, `snapshot`, `warnings`, and
|
|
29
|
+
`data.backend.completeness`; use stable codes rather than message text.
|
|
30
|
+
3. Run `semantic-atlas index` when freshness is `missing` or `stale`, or when
|
|
31
|
+
backend completeness is not `complete`. Indexing owns generated `.atlas/`
|
|
32
|
+
state inside this worktree.
|
|
33
|
+
4. Run `semantic-atlas map roots` on a current snapshot. Business `Capability`
|
|
34
|
+
roots appear after learning; structural `Module` roots provide the initial
|
|
35
|
+
map before business knowledge exists.
|
|
36
|
+
5. Extract two to four compact concepts from the task: business vocabulary,
|
|
37
|
+
likely symbols, interfaces or data, and dependency/impact terms. Use those
|
|
38
|
+
concepts to begin the recurring-task protocol.
|
|
39
|
+
|
|
40
|
+
When the CLI, repository, or language is unavailable, follow [result
|
|
41
|
+
routing](references/result-routing.md) and continue through bounded source
|
|
42
|
+
fallback.
|
|
43
|
+
|
|
44
|
+
## Recurring task
|
|
45
|
+
|
|
46
|
+
1. Start every distinct task with `semantic-atlas status`. Trust a stored map
|
|
47
|
+
only when the world snapshot is current and the backend is complete.
|
|
48
|
+
2. Query before broad source exploration:
|
|
49
|
+
- use `semantic-atlas map search <query> [--limit <n>]` for each compact
|
|
50
|
+
lexical concept;
|
|
51
|
+
- use `semantic-atlas map show <node-id> [--depth <n>]` to inspect promising
|
|
52
|
+
nodes, evidence-rich neighbors, invariants, tests, and unknown boundaries;
|
|
53
|
+
- use `semantic-atlas map children <node-id>` to descend business `part_of`
|
|
54
|
+
or structural `contains` hierarchies;
|
|
55
|
+
- revisit `semantic-atlas map roots` when the task crosses capabilities or
|
|
56
|
+
the first search vocabulary is weak.
|
|
57
|
+
3. Begin with depth 1 and expand a promising node to depth 2 or 3 only when the
|
|
58
|
+
task requires the additional dependency path. Treat search score as ranking,
|
|
59
|
+
not certainty.
|
|
60
|
+
4. Stop map traversal when it identifies the necessary symbols, files,
|
|
61
|
+
relationships, evidence, and explicit uncertainty for the task. Open the
|
|
62
|
+
cited source ranges to confirm behavior that controls the answer or change.
|
|
63
|
+
5. Perform implementation, debugging, tests, and review through the normal
|
|
64
|
+
engineering workflow, using the Atlas results as bounded context.
|
|
65
|
+
|
|
66
|
+
## Interpret Atlas results
|
|
67
|
+
|
|
68
|
+
Classify every result before using it:
|
|
69
|
+
|
|
70
|
+
| Result | Agent treatment |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `valid` plus `exact` | Use as current evidence for the stated assertion and confirm decisive behavior in source. |
|
|
73
|
+
| `valid` plus `inferred` | Preserve the result as a supported Agent inference and inspect source before presenting it as exact. |
|
|
74
|
+
| `hypothesis` | Treat as an exploration lead and verify it independently. |
|
|
75
|
+
| `stale` | Use identity and vocabulary only; reindex, then re-open authoritative source for the assertion. |
|
|
76
|
+
| `unknown` | Preserve the owner-linked unknown boundary, reason, location, and candidates; inspect that bounded source area. |
|
|
77
|
+
| `unsupported` | Use supported results as partial context and inspect the unsupported language or construct in source. |
|
|
78
|
+
| `partial` | Consume usable fields and route each warning or boundary independently. |
|
|
79
|
+
| `insufficient` map | Fall back from the best available seeds and complete the task from source. |
|
|
80
|
+
|
|
81
|
+
Structural `support.status` describes backend resolution. Business `certainty`
|
|
82
|
+
describes the Agent's assertion. Business `validity` describes evidence
|
|
83
|
+
freshness. Keep these dimensions separate: an exact call edge alone does not
|
|
84
|
+
prove a business rule, and a current hypothesis remains a hypothesis.
|
|
85
|
+
|
|
86
|
+
Read [result routing](references/result-routing.md) when status, index, or a map
|
|
87
|
+
query returns an error envelope, warnings, no relevant results, or competing
|
|
88
|
+
candidates.
|
|
89
|
+
|
|
90
|
+
## Bounded source fallback
|
|
91
|
+
|
|
92
|
+
1. Assemble the smallest source seed set from current result locations,
|
|
93
|
+
evidence, structural IDs, unknown owners, and finite candidates.
|
|
94
|
+
2. Open the cited ranges and enough surrounding code to understand the owning
|
|
95
|
+
declaration. Follow only the imports, callers, callees, interfaces, data, or
|
|
96
|
+
tests required by the task.
|
|
97
|
+
3. Reformulate one Atlas query when source supplies a more precise business or
|
|
98
|
+
symbol term. This often reconnects the task to mapped context.
|
|
99
|
+
4. When Atlas supplies no usable seed, run a narrow ordinary source search for
|
|
100
|
+
the task's most distinctive identifier or contract, then continue the normal
|
|
101
|
+
source workflow from confirmed results.
|
|
102
|
+
5. Base the conclusion on source for every stale, hypothesis, unknown,
|
|
103
|
+
unsupported, ambiguous, or map-insufficient portion. Retain the boundary in
|
|
104
|
+
the answer when source inspection cannot resolve it.
|
|
105
|
+
|
|
106
|
+
This fallback bounds discovery without replacing the calling Agent's generic
|
|
107
|
+
source-reading and search capabilities.
|
|
108
|
+
|
|
109
|
+
## After source changes
|
|
110
|
+
|
|
111
|
+
1. Preserve the pre-change current snapshot ID when the task may need impact or
|
|
112
|
+
semantic-change inspection.
|
|
113
|
+
2. Complete source editing and relevant tests through the normal workflow.
|
|
114
|
+
3. Run `semantic-atlas index` after relevant source changes. Treat a failed or
|
|
115
|
+
incomplete publication as unavailable map state and keep working from source.
|
|
116
|
+
4. Run `semantic-atlas changes`; provide `--from <snapshot-id>` and
|
|
117
|
+
`--to <snapshot-id>` when the task requires an explicit persisted range.
|
|
118
|
+
5. Inspect node and relation additions, changes, removals, and
|
|
119
|
+
`staleAssertions`. Re-run map queries for affected concepts and confirm the
|
|
120
|
+
resulting impact against source and tests.
|
|
121
|
+
6. Consider learning only after the new snapshot is current and the engineering
|
|
122
|
+
result is verified.
|
|
123
|
+
|
|
124
|
+
Structural fact counters summarize graph publication work; semantic impact
|
|
125
|
+
comes from `changes`, map traversal, source, and tests.
|
|
126
|
+
|
|
127
|
+
## Learn verified knowledge
|
|
128
|
+
|
|
129
|
+
Learning is optional. Use it for durable business capabilities, scenarios,
|
|
130
|
+
operations, invariants, interfaces, data, and their supported relationships
|
|
131
|
+
when that knowledge will help later tasks.
|
|
132
|
+
|
|
133
|
+
1. Read [GraphPatch authoring](references/graph-patch.md).
|
|
134
|
+
2. Recheck `semantic-atlas status` immediately before authoring. Use the current
|
|
135
|
+
snapshot ID as `baseSnapshotId`.
|
|
136
|
+
3. Derive evidence from current map results and inspected source. Every evidence
|
|
137
|
+
item must use a current structural symbol ID, exact repository-relative file,
|
|
138
|
+
one-based range, and current file `contentHash` returned by Atlas.
|
|
139
|
+
4. Choose `exact` for uniquely proven assertions, `inferred` for supported Agent
|
|
140
|
+
synthesis, and `hypothesis` for explicitly exploratory knowledge. Prefer
|
|
141
|
+
fresh, exact evidence for durable facts.
|
|
142
|
+
5. Send one complete JSON GraphPatch value to `semantic-atlas learn --stdin`.
|
|
143
|
+
Apply related operations together so optimistic-concurrency validation is
|
|
144
|
+
atomic.
|
|
145
|
+
6. Inspect the response and query the learned key with `semantic-atlas map show`
|
|
146
|
+
to verify the resulting certainty, validity, evidence, and relationships.
|
|
147
|
+
7. If the snapshot or evidence changed, refresh the map and rebuild the patch
|
|
148
|
+
from current results. The current snapshot ID and evidence are the write
|
|
149
|
+
boundary.
|
|
150
|
+
|
|
151
|
+
## Answer contract
|
|
152
|
+
|
|
153
|
+
Use Atlas internally as context rather than dumping raw envelopes. In the task
|
|
154
|
+
answer:
|
|
155
|
+
|
|
156
|
+
- state the relevant business concept, files, symbols, and relationships;
|
|
157
|
+
- distinguish current exact evidence from Agent inference;
|
|
158
|
+
- identify stale, hypothesis, unknown, unsupported, ambiguous, or insufficient
|
|
159
|
+
portions and the source inspection used to handle them;
|
|
160
|
+
- cite the authoritative source and relevant verification for engineering
|
|
161
|
+
conclusions;
|
|
162
|
+
- mention reindexing, semantic changes, or learned knowledge when those actions
|
|
163
|
+
materially affect the result.
|
|
164
|
+
|
|
165
|
+
## Responsibility boundary
|
|
166
|
+
|
|
167
|
+
Semantic Atlas owns deterministic indexing, revision-aware map queries,
|
|
168
|
+
semantic change records, and evidence-bound business knowledge in local Atlas
|
|
169
|
+
data. The calling Agent owns concept extraction, natural-language reasoning,
|
|
170
|
+
source editing, tests, Git operations, and review. Keep repository-specific
|
|
171
|
+
facts in Atlas or authoritative source; keep this Skill reusable across
|
|
172
|
+
repositories.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# GraphPatch authoring
|
|
2
|
+
|
|
3
|
+
Read this reference only when durable, verified business knowledge should be
|
|
4
|
+
written to Semantic Atlas.
|
|
5
|
+
|
|
6
|
+
## Preconditions
|
|
7
|
+
|
|
8
|
+
1. `status` identifies the intended worktree and a current, complete world
|
|
9
|
+
snapshot.
|
|
10
|
+
2. The Agent has inspected the relevant source and can state the assertion,
|
|
11
|
+
certainty, and evidence separately.
|
|
12
|
+
3. Current map output supplies every structural symbol ID, exact source range,
|
|
13
|
+
and file `contentHash` used as evidence.
|
|
14
|
+
4. The knowledge is reusable business meaning rather than a task note,
|
|
15
|
+
implementation instruction, test result, Git fact, or generic code summary.
|
|
16
|
+
|
|
17
|
+
Use the repository's `schemas/graph-patch-v1.schema.json` and
|
|
18
|
+
`docs/contracts/graph-patch-v1.md` as the normative contract when they are
|
|
19
|
+
available. The outline here is an authoring checklist.
|
|
20
|
+
|
|
21
|
+
## Patch shape
|
|
22
|
+
|
|
23
|
+
A patch is one strict JSON object:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"schemaVersion": 1,
|
|
28
|
+
"baseSnapshotId": "<current 64-character snapshot ID>",
|
|
29
|
+
"nodeOperations": [],
|
|
30
|
+
"relationOperations": []
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Node operations upsert or remove business keys. Relation operations upsert or
|
|
35
|
+
remove a `(from, type, to)` relationship. A single patch can create related
|
|
36
|
+
nodes and connect them atomically.
|
|
37
|
+
|
|
38
|
+
## Business vocabulary
|
|
39
|
+
|
|
40
|
+
Node kinds:
|
|
41
|
+
|
|
42
|
+
- `Capability`: a durable business ability;
|
|
43
|
+
- `Scenario`: a user or system scenario within a capability;
|
|
44
|
+
- `Operation`: a business action or use-case step;
|
|
45
|
+
- `Invariant`: a rule constraining behavior or data;
|
|
46
|
+
- `Interface`: an API, event, queue, or integration contract;
|
|
47
|
+
- `Data`: a business data concept or persisted record.
|
|
48
|
+
|
|
49
|
+
Use stable lowercase hierarchical keys such as
|
|
50
|
+
`<domain>/<capability>/<concept>`. Labels and aliases provide vocabulary;
|
|
51
|
+
summaries state evidence-bound assertions.
|
|
52
|
+
|
|
53
|
+
Business relation types:
|
|
54
|
+
|
|
55
|
+
- `part_of`, `reads`, `writes`, `publishes`, `consumes`, and `constrained_by`
|
|
56
|
+
connect a business source to a business target;
|
|
57
|
+
- `realized_by` and `verified_by` connect a business source to a structural
|
|
58
|
+
target.
|
|
59
|
+
|
|
60
|
+
Every learned relation originates at a business node.
|
|
61
|
+
|
|
62
|
+
## Evidence
|
|
63
|
+
|
|
64
|
+
Every upserted node summary and relation includes at least one evidence item:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"symbolId": "symbol:<Atlas structural identity>",
|
|
69
|
+
"file": "<repository-relative source path>",
|
|
70
|
+
"range": {
|
|
71
|
+
"start": { "line": 1, "column": 1 },
|
|
72
|
+
"end": { "line": 1, "column": 1 }
|
|
73
|
+
},
|
|
74
|
+
"contentHash": "<current Atlas file content hash>"
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Copy structural identity, path, range, and hash from a current Atlas map result.
|
|
79
|
+
Atlas validates that the symbol resolves, path and range match, and file hash is
|
|
80
|
+
current. Evidence outside the worktree or fabricated from source text is not a
|
|
81
|
+
valid binding.
|
|
82
|
+
|
|
83
|
+
Certainty is independent from evidence freshness:
|
|
84
|
+
|
|
85
|
+
- `exact` means the evidence uniquely proves the assertion;
|
|
86
|
+
- `inferred` means the evidence supports an explicit Agent synthesis;
|
|
87
|
+
- `hypothesis` marks exploratory knowledge that remains visibly unverified.
|
|
88
|
+
|
|
89
|
+
Use one assertion per clear business meaning. Multiple source locations can
|
|
90
|
+
support one assertion; one nearby symbol should not stand in for an unproven
|
|
91
|
+
workflow.
|
|
92
|
+
|
|
93
|
+
## Submission and conflicts
|
|
94
|
+
|
|
95
|
+
Send exactly one complete JSON value through standard input:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
semantic-atlas learn --stdin < /path/to/graph-patch.json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Keep transient patch drafts outside tracked repository content. On an invalid
|
|
102
|
+
input error, correct the schema or reference. On snapshot, evidence, or
|
|
103
|
+
repository-boundary rejection, run `status`, re-query the current map, and
|
|
104
|
+
rebuild the patch from current evidence. Preserve atomic intent rather than
|
|
105
|
+
partially replaying operations.
|
|
106
|
+
|
|
107
|
+
After success, inspect the returned operation counts and run `map show` for the
|
|
108
|
+
learned key. Confirm its certainty, `valid` status, evidence, and intended
|
|
109
|
+
relationships before relying on it in later tasks.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Result routing
|
|
2
|
+
|
|
3
|
+
Use this reference when a Semantic Atlas command produces missing, stale,
|
|
4
|
+
partial, unsupported, unknown, ambiguous, empty, or error results.
|
|
5
|
+
|
|
6
|
+
## Envelope discipline
|
|
7
|
+
|
|
8
|
+
Every handled CLI command writes one JSON envelope to standard output. Read:
|
|
9
|
+
|
|
10
|
+
- `schemaVersion` before interpreting fields;
|
|
11
|
+
- `status` as `ok`, `partial`, or `error`;
|
|
12
|
+
- `repository.root` to confirm the intended worktree;
|
|
13
|
+
- `snapshot.id` and `snapshot.freshness` for the published world;
|
|
14
|
+
- `data.command` before consuming command-specific fields;
|
|
15
|
+
- `warnings[].code` as the stable warning identity.
|
|
16
|
+
|
|
17
|
+
Treat additive command fields as optional. Use the command discriminant and
|
|
18
|
+
documented fields rather than matching prose messages.
|
|
19
|
+
|
|
20
|
+
## Freshness and availability
|
|
21
|
+
|
|
22
|
+
| Observation | Route |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `data.freshness: "current"`, complete backend | Query the map. |
|
|
25
|
+
| `data.freshness: "missing"` | Run `index`, then inspect its envelope before querying. |
|
|
26
|
+
| `data.freshness: "stale"` | Run `index`; use old business identities only as vocabulary until publication completes. |
|
|
27
|
+
| Backend `missing`, `building`, `failed`, or `incomplete` | Run or retry `index` when appropriate; use source while no complete publication exists. |
|
|
28
|
+
| `ATLAS_STATE_MISSING` or `ATLAS_STATE_STALE` | Refresh with `status` and `index`; repeat the query only against a current publication. |
|
|
29
|
+
| `UNSUPPORTED_REPOSITORY` | Record the unsupported repository boundary and use the normal source workflow. |
|
|
30
|
+
|
|
31
|
+
An index result can be `partial` while still publishing useful current data.
|
|
32
|
+
Route its unsupported-language, stale-assertion, and unknown-boundary warnings
|
|
33
|
+
individually.
|
|
34
|
+
|
|
35
|
+
## Query results
|
|
36
|
+
|
|
37
|
+
### Empty or weak search
|
|
38
|
+
|
|
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.
|
|
47
|
+
|
|
48
|
+
Lexical scores rank results only. A high score does not establish correctness,
|
|
49
|
+
certainty, or business meaning.
|
|
50
|
+
|
|
51
|
+
### Unknown and ambiguity
|
|
52
|
+
|
|
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.
|
|
64
|
+
|
|
65
|
+
### Stale assertions
|
|
66
|
+
|
|
67
|
+
A stale business node keeps useful key, label, and aliases while its summary or
|
|
68
|
+
relations lack current evidence. Reindex first. Then inspect the changed or
|
|
69
|
+
missing evidence and either use current source for the task or submit a new
|
|
70
|
+
GraphPatch after verification.
|
|
71
|
+
|
|
72
|
+
### Unsupported structure
|
|
73
|
+
|
|
74
|
+
Continue using supported nodes and relations as partial context. Inspect the
|
|
75
|
+
unsupported file, language, runtime behavior, reflection, or generated contract
|
|
76
|
+
through normal source tools. Keep the unsupported portion separate from exact
|
|
77
|
+
Atlas facts.
|
|
78
|
+
|
|
79
|
+
## Error outcomes
|
|
80
|
+
|
|
81
|
+
| Exit code | Meaning and route |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `0` | Consume `ok` or `partial` data. |
|
|
84
|
+
| `1` | Treat as an internal failure; preserve diagnostics and use source. |
|
|
85
|
+
| `2` | Correct command, option, stdin, or schema input before retrying. |
|
|
86
|
+
| `3` | Confirm repository discovery and supported languages; use source for a genuinely unsupported repository. |
|
|
87
|
+
| `4` | Refresh missing/stale state or select a persisted change range. |
|
|
88
|
+
| `5` | Refresh the current snapshot/evidence, rebuild the GraphPatch, and retry only when the patch still represents verified knowledge. |
|
|
89
|
+
|
|
90
|
+
Handled errors still use JSON envelopes. Unexpected diagnostics belong to
|
|
91
|
+
standard error and remain troubleshooting evidence rather than map facts.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zijian Liao
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Semantic Atlas
|
|
2
|
+
|
|
3
|
+
Semantic Atlas is a local, revision-aware project world model for AI coding agents. It combines CodeGraph-backed TypeScript and JavaScript structure with agent-verified business capabilities, flows, data, rules, and interfaces in one evidence-bound map.
|
|
4
|
+
|
|
5
|
+
Semantic Atlas is an AI-agent tool, not a natural-language engine. The deterministic CLI accepts commands, lexical search terms, graph identifiers, and structured GraphPatch input. The calling agent interprets a task, judges evidence, reads source when the map is insufficient, and performs all code and Git work.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Node.js 22.12 through 24
|
|
10
|
+
- A Git worktree containing TypeScript or JavaScript
|
|
11
|
+
- Codex or another agent that can follow the packaged Skill workflow
|
|
12
|
+
|
|
13
|
+
## Install the CLI
|
|
14
|
+
|
|
15
|
+
Install the public executable globally:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install --global semantic-atlas
|
|
19
|
+
semantic-atlas status --repo /path/to/project
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The installed runtime works offline. Indexing, graph queries, evidence validation, and change inspection do not call a model or a network service. Package installation itself still requires normal npm registry access.
|
|
23
|
+
|
|
24
|
+
## Install the Codex Skill
|
|
25
|
+
|
|
26
|
+
The Skill teaches Codex when to trust the map, when to reindex, how to preserve unknown boundaries, and when to fall back to authoritative source. In Codex, invoke the built-in installer with the repository-owned Skill URL:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
$skill-installer Install semantic-atlas from https://github.com/lzj960515/semantic-atlas/tree/v0.1.0/.agents/skills/semantic-atlas
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For repository development, Codex discovers the checked-in Skill automatically from `.agents/skills/semantic-atlas`. Codex detects newly installed skills automatically; restart Codex if it does not appear in the skill list.
|
|
33
|
+
|
|
34
|
+
Invoke it explicitly with `$semantic-atlas`, or let Codex select it for project understanding and impact-analysis tasks.
|
|
35
|
+
|
|
36
|
+
## First use
|
|
37
|
+
|
|
38
|
+
Run these commands from the target worktree. `--repo <path>` can be supplied before the command when the current directory is elsewhere.
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
semantic-atlas status
|
|
42
|
+
semantic-atlas index
|
|
43
|
+
semantic-atlas map roots
|
|
44
|
+
semantic-atlas map search checkout --limit 10
|
|
45
|
+
semantic-atlas map show module:src --depth 1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The normal agent loop is:
|
|
49
|
+
|
|
50
|
+
1. Check `status` before trusting stored knowledge.
|
|
51
|
+
2. Run `index` when the snapshot is missing, stale, failed, or incomplete.
|
|
52
|
+
3. Use `map roots`, `map search`, `map children`, and `map show` for bounded context.
|
|
53
|
+
4. Inspect source for stale, unsupported, unresolved, ambiguous, or insufficient results.
|
|
54
|
+
5. After source changes, reindex and inspect `changes`.
|
|
55
|
+
6. Submit verified business knowledge with `learn --stdin` against the current snapshot.
|
|
56
|
+
|
|
57
|
+
Every command writes one versioned JSON envelope to standard output. Diagnostics remain on standard error, so callers can parse output without scraping prose.
|
|
58
|
+
|
|
59
|
+
## Zero-intrusion storage
|
|
60
|
+
|
|
61
|
+
Each worktree owns one generated store:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
<worktree>/.atlas/codegraph.db
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Semantic Atlas creates an Atlas-owned `.atlas/.gitignore`, keeps transient locks and SQLite sidecars under `.atlas/`, and leaves tracked source and project configuration unchanged. CodeGraph owns structural tables while Atlas owns namespaced `atlas_*` business, evidence, snapshot, and validity tables in the same database. Public queries compose one world graph without copying the structural graph.
|
|
68
|
+
|
|
69
|
+
## Scope and uncertainty
|
|
70
|
+
|
|
71
|
+
v0.1 supports TypeScript and JavaScript, with initial business-flow coverage for NestJS, GraphQL, TypeORM, and BullMQ projects. The embedded `@colbymchenry/codegraph` SDK supplies static structure; Atlas adds revision-aware business interpretation and evidence.
|
|
72
|
+
|
|
73
|
+
Runtime-only dispatch, reflection, generated behavior, unsupported syntax, and unresolved targets remain explicit boundaries. An `UnknownBoundary`, stale assertion, hypothesis, or unsupported result is a prompt for bounded source inspection, never an exact business claim. Source code remains authoritative.
|
|
74
|
+
|
|
75
|
+
Semantic Atlas does not edit source, run project tests, mutate Git history, review code, or publish releases on behalf of the calling agent.
|
|
76
|
+
|
|
77
|
+
## CLI reference
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
semantic-atlas status [--repo <path>] [--pretty]
|
|
81
|
+
semantic-atlas index [--repo <path>] [--pretty]
|
|
82
|
+
semantic-atlas map roots [--repo <path>] [--pretty]
|
|
83
|
+
semantic-atlas map search <query> [--limit <n>] [--repo <path>] [--pretty]
|
|
84
|
+
semantic-atlas map children <node-id> [--repo <path>] [--pretty]
|
|
85
|
+
semantic-atlas map show <node-id> [--depth <n>] [--repo <path>] [--pretty]
|
|
86
|
+
semantic-atlas learn --stdin [--repo <path>] [--pretty]
|
|
87
|
+
semantic-atlas changes [--from <snapshot-id>] [--to <snapshot-id>] [--repo <path>] [--pretty]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
See the versioned [CLI contract](docs/contracts/cli-v1.md) and [GraphPatch contract](docs/contracts/graph-patch-v1.md) for field-level behavior.
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
corepack enable
|
|
96
|
+
pnpm install --frozen-lockfile
|
|
97
|
+
pnpm typecheck
|
|
98
|
+
pnpm test
|
|
99
|
+
pnpm build
|
|
100
|
+
pnpm package:verify
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`pnpm package:verify` packs the project, installs the tarball into a temporary consumer outside the checkout, and runs a real `status` -> `index` -> `map roots` CLI flow while checking that the fixture Git status stays clean. `pnpm validation:backend` provides the deeper pinned-backend and upgrade contract.
|
|
104
|
+
|
|
105
|
+
CI runs typecheck, build, contract checks, and installed-package tests on Node.js 22.12 and 24. The complete source test suite runs on the Node.js 24 development runtime, while Linux, macOS, and Windows jobs execute the installed CLI smoke flow.
|
|
106
|
+
|
|
107
|
+
## Contracts
|
|
108
|
+
|
|
109
|
+
- [Product contract](docs/product-contract.md)
|
|
110
|
+
- [CodeGraph backend architecture](docs/architecture/codegraph-backend.md)
|
|
111
|
+
- [Graph model](docs/contracts/graph-model.md)
|
|
112
|
+
- [CLI v1](docs/contracts/cli-v1.md)
|
|
113
|
+
- [GraphPatch v1](docs/contracts/graph-patch-v1.md)
|
|
114
|
+
- [Fresh Agent evaluation](docs/evaluation.md)
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
Semantic Atlas is released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GitRepository } from "../repository/types.js";
|
|
2
|
+
import type { StructuralIndexBackend } from "../structural-backend/types.js";
|
|
3
|
+
import type { BusinessFlowDerivationOptions, DerivedBusinessFlow } from "./types.js";
|
|
4
|
+
export declare class BusinessFlowDerivationService {
|
|
5
|
+
private readonly repository;
|
|
6
|
+
private readonly structural;
|
|
7
|
+
constructor(repository: GitRepository, structural?: StructuralIndexBackend);
|
|
8
|
+
derive(options: BusinessFlowDerivationOptions): Promise<DerivedBusinessFlow>;
|
|
9
|
+
private currentWorld;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=business-flow-derivation-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-flow-derivation-service.d.ts","sourceRoot":"","sources":["../../src/business-flow/business-flow-derivation-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAW7E,OAAO,KAAK,EACV,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,YAAY,CAAC;AASpB,qBAAa,6BAA6B;IAEtC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,UAAU,EAAE,aAAa,EACzB,UAAU,GAAE,sBAAmE;IAG5F,MAAM,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA+BlF,OAAO,CAAC,YAAY;CAIrB"}
|