semantic-atlas 2.1.3 → 2.3.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 (92) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +47 -9
  2. package/.agents/skills/semantic-atlas/references/observations.md +4 -0
  3. package/.agents/skills/semantic-atlas-maintenance/SKILL.md +23 -6
  4. package/.agents/skills/semantic-atlas-maintenance/references/reconciliation.md +4 -0
  5. package/README.md +59 -31
  6. package/README.zh-CN.md +45 -27
  7. package/dist/application/map-application.d.ts +2 -1
  8. package/dist/application/map-application.d.ts.map +1 -1
  9. package/dist/application/map-application.js +4 -3
  10. package/dist/application/map-application.js.map +1 -1
  11. package/dist/cli/run-cli.d.ts +2 -0
  12. package/dist/cli/run-cli.d.ts.map +1 -1
  13. package/dist/cli/run-cli.js +41 -3
  14. package/dist/cli/run-cli.js.map +1 -1
  15. package/dist/contracts/cli.d.ts +11 -1
  16. package/dist/contracts/cli.d.ts.map +1 -1
  17. package/dist/contracts/map.d.ts +80 -1
  18. package/dist/contracts/map.d.ts.map +1 -1
  19. package/dist/contracts/map.js +29 -0
  20. package/dist/contracts/map.js.map +1 -1
  21. package/dist/contracts/observation.d.ts +3 -0
  22. package/dist/contracts/observation.d.ts.map +1 -1
  23. package/dist/contracts/observation.js +1 -1
  24. package/dist/contracts/observation.js.map +1 -1
  25. package/dist/contracts/project.d.ts +7 -0
  26. package/dist/contracts/project.d.ts.map +1 -0
  27. package/dist/contracts/project.js +6 -0
  28. package/dist/contracts/project.js.map +1 -0
  29. package/dist/contracts/projection.d.ts +1 -0
  30. package/dist/contracts/projection.d.ts.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/map/business-flow-validator.d.ts +3 -0
  35. package/dist/map/business-flow-validator.d.ts.map +1 -0
  36. package/dist/map/business-flow-validator.js +152 -0
  37. package/dist/map/business-flow-validator.js.map +1 -0
  38. package/dist/map/business-graph.d.ts +3 -1
  39. package/dist/map/business-graph.d.ts.map +1 -1
  40. package/dist/map/business-graph.js +11 -0
  41. package/dist/map/business-graph.js.map +1 -1
  42. package/dist/map/map-validator.d.ts.map +1 -1
  43. package/dist/map/map-validator.js +31 -2
  44. package/dist/map/map-validator.js.map +1 -1
  45. package/dist/projects/project-registration-service.d.ts +20 -0
  46. package/dist/projects/project-registration-service.d.ts.map +1 -0
  47. package/dist/projects/project-registration-service.js +41 -0
  48. package/dist/projects/project-registration-service.js.map +1 -0
  49. package/dist/projects/project-store.d.ts +20 -0
  50. package/dist/projects/project-store.d.ts.map +1 -0
  51. package/dist/projects/project-store.js +89 -0
  52. package/dist/projects/project-store.js.map +1 -0
  53. package/dist/query/context-query-service.d.ts.map +1 -1
  54. package/dist/query/context-query-service.js +1 -0
  55. package/dist/query/context-query-service.js.map +1 -1
  56. package/dist/rendering/flow-projector.d.ts +9 -0
  57. package/dist/rendering/flow-projector.d.ts.map +1 -0
  58. package/dist/rendering/flow-projector.js +226 -0
  59. package/dist/rendering/flow-projector.js.map +1 -0
  60. package/dist/rendering/latest-project-loader.d.ts +2 -0
  61. package/dist/rendering/latest-project-loader.d.ts.map +1 -0
  62. package/dist/rendering/latest-project-loader.js +26 -0
  63. package/dist/rendering/latest-project-loader.js.map +1 -0
  64. package/dist/rendering/map-projector.d.ts.map +1 -1
  65. package/dist/rendering/map-projector.js +7 -3
  66. package/dist/rendering/map-projector.js.map +1 -1
  67. package/dist/rendering/viewer-browser.d.ts.map +1 -1
  68. package/dist/rendering/viewer-browser.js +226 -19
  69. package/dist/rendering/viewer-browser.js.map +1 -1
  70. package/dist/rendering/viewer-page.d.ts +31 -1
  71. package/dist/rendering/viewer-page.d.ts.map +1 -1
  72. package/dist/rendering/viewer-page.js +158 -21
  73. package/dist/rendering/viewer-page.js.map +1 -1
  74. package/dist/web/local-web-application.d.ts +15 -2
  75. package/dist/web/local-web-application.d.ts.map +1 -1
  76. package/dist/web/local-web-application.js +62 -16
  77. package/dist/web/local-web-application.js.map +1 -1
  78. package/dist/web/local-web-server.d.ts.map +1 -1
  79. package/dist/web/local-web-server.js +46 -8
  80. package/dist/web/local-web-server.js.map +1 -1
  81. package/dist/web/web-command-service.d.ts +4 -2
  82. package/dist/web/web-command-service.d.ts.map +1 -1
  83. package/dist/web/web-command-service.js +6 -2
  84. package/dist/web/web-command-service.js.map +1 -1
  85. package/docs/architecture.md +135 -58
  86. package/docs/evaluation.md +18 -3
  87. package/docs/index.md +1 -1
  88. package/docs/map-format.md +99 -5
  89. package/docs/observations.md +3 -1
  90. package/docs/product-contract.md +59 -23
  91. package/examples/commerce.yaml +50 -0
  92. package/package.json +1 -1
@@ -4,9 +4,10 @@ This page defines the stable responsibilities, data lifecycle, dependency
4
4
  direction, and failure semantics for the initial product. It applies to the
5
5
  public CLI, renderer, and business-understanding Agent Skill.
6
6
 
7
- **Status: query, validation, visual projection, Agent Skills, managed
8
- Skill lifecycle, accuracy observations, read-only reconciliation, and public
9
- release verification are implemented and released.**
7
+ **Status: query, validation, visual projection, Agent Skills, managed Skill
8
+ lifecycle, accuracy observations, read-only reconciliation, and public release
9
+ verification are implemented. Persistent project registration and on-demand
10
+ Web loading are implemented in the current source candidate.**
10
11
 
11
12
  ## System Model
12
13
 
@@ -14,15 +15,15 @@ release verification are implemented and released.**
14
15
  tracked map documents
15
16
  |
16
17
  v
17
- MapDocumentLoader -> MapValidator -> BusinessGraph
18
- |
19
- +--------------+--------------+
20
- | |
21
- v v
22
- ContextQueryService MapProjector
23
- | |
24
- v v
25
- stable JSON result SVG / static HTML
18
+ MapDocumentLoader -> MapValidator -> BusinessFlowValidator -> BusinessGraph
19
+ |
20
+ +---------------------------+-------------------+
21
+ | |
22
+ v v
23
+ ContextQueryService MapProjector + FlowProjector
24
+ | |
25
+ v v
26
+ relationship + flow JSON shared relationship / flow Viewer
26
27
 
27
28
  Calling Agent
28
29
  -> activates from business task meaning
@@ -70,11 +71,21 @@ verified source candidate -> annotated release tag -> published GitHub Release
70
71
  |
71
72
  v
72
73
  provenance publication + public read-back
74
+
75
+ project add [path] -> complete map validation -> user-local ProjectStore
76
+ |
77
+ parameterless web ----------------------------------+
78
+ explicit web --repo -> temporary session paths -----+-> LocalWebApplication
79
+ |
80
+ Viewer catalog <- GET / -----------------------------+
81
+ Viewer selection -> GET /api/projects/<opaque-id> -> one validated projection
73
82
  ```
74
83
 
75
84
  The tracked documents and their Git history are the shared product state. Each
76
- command creates an in-memory graph for its own invocation. Rendering and future
77
- local acceleration remain derived behavior around that same graph.
85
+ map load creates an in-memory graph for its own invocation. Rendering and future
86
+ local acceleration remain derived behavior around that same graph. The
87
+ user-local project list supplies only checkout selection and never becomes a
88
+ second graph or map-authoring source.
78
89
 
79
90
  ## Stable Responsibilities
80
91
 
@@ -92,19 +103,28 @@ actionable issue that can be collected safely in one run, including duplicate
92
103
  IDs, missing relation endpoints, containment cycles, invalid kinds, and
93
104
  malformed anchors. It owns deterministic validity, not current-source truth.
94
105
 
106
+ ### BusinessFlowValidator
107
+
108
+ Validates scenario ownership, flow and step identity, concept and transition
109
+ references, action/decision/outcome branch shape, and reachability. Cycles are
110
+ valid. It owns structural flow coherence while current source and durable
111
+ product evidence decide whether the described business path is current.
112
+
95
113
  ### BusinessGraph
96
114
 
97
- Holds normalized immutable nodes, relations, aliases, containment indexes, and
98
- incoming/outgoing relation indexes for one command. It exposes domain
99
- operations in terms of business concepts rather than file layout or parser
100
- objects.
115
+ Holds normalized immutable nodes, relations, flows, aliases, containment
116
+ indexes, and incoming/outgoing relation indexes for one command. It exposes
117
+ domain operations in terms of business concepts and scenario paths rather than
118
+ file layout or parser objects. Related flows are derived from scenario
119
+ containment and step concept references.
101
120
 
102
121
  ### ContextQueryService
103
122
 
104
123
  Resolves a concept by stable ID, name, or alias and returns the smallest useful
105
124
  business neighborhood: ancestors, direct children, incoming and outgoing
106
- relations, referenced concepts, summaries, and navigation anchors. It reports
107
- ambiguity explicitly rather than selecting a hidden match.
125
+ relations, referenced concepts, summaries, navigation anchors, and complete
126
+ related flows. It reports ambiguity explicitly rather than selecting a hidden
127
+ match.
108
128
 
109
129
  ### MapProjector
110
130
 
@@ -114,26 +134,60 @@ concepts as visible boundary nodes. Every projection distinguishes semantic
114
134
  containment from directed horizontal relations and preserves stable element
115
135
  identities for repeatable layout and inspection.
116
136
 
137
+ ### FlowProjector
138
+
139
+ Builds one deterministic top-to-bottom SVG per business flow. Dagre owns step
140
+ placement and transition routing; action, decision, and outcome steps preserve
141
+ distinct visual semantics, while labeled decision branches remain visible on
142
+ their transitions. The projector reads normalized flow meaning and owns no
143
+ query or maintenance decisions.
144
+
117
145
  ### ViewerPage
118
146
 
119
147
  Owns the compact human inspection surface shared by static export and Web. It
120
- combines project and business-domain selection, map statistics, a restrained
121
- legend, pan, zoom, and fit-to-view around deterministic SVG projections. Cards
122
- render stable business meaning only. Pointer or keyboard selection opens the
123
- node's navigation anchors in an overlaid desktop side panel or narrow-screen
124
- bottom panel without relaying out the graph. Camera coordinates use the SVG
125
- `xMidYMid meet` scale and letterbox offsets for both pointer zoom and pan. Its
126
- browser interaction state is disposable and never enters tracked map data.
148
+ combines project selection, relationship/flow switching, business-domain or
149
+ flow selection, map statistics, a restrained legend, pan, zoom, and fit-to-view
150
+ around deterministic SVG projections. Cards render stable business meaning
151
+ only. Pointer or keyboard selection opens the node's navigation anchors and
152
+ derived related-flow links in an overlaid desktop side panel or narrow-screen
153
+ bottom panel. Selecting a related flow switches to its projected path. Camera
154
+ coordinates use the SVG `xMidYMid meet` scale and letterbox offsets for both
155
+ pointer zoom and pan. Its browser interaction state is disposable and never
156
+ enters tracked map data.
157
+
158
+ Static export embeds its complete project model and SVG. Web mode initially
159
+ receives only project IDs and display names, then replaces its single current
160
+ model and SVG set when a selection loads. Empty, loading, ready, and unavailable
161
+ states are browser-session state. A monotonically increasing request generation
162
+ and cancellation signal prevent an older project request from replacing a
163
+ newer selection.
164
+
165
+ ### ProjectStore And ProjectRegistrationService
166
+
167
+ `ProjectStore` owns the versioned `~/.semantic-atlas/projects.json` document. A
168
+ missing file means an empty project list. It strictly reads normalized absolute
169
+ checkout paths, appends a new path idempotently, and publishes the complete list
170
+ through a unique temporary file and atomic replacement. This disposable local
171
+ configuration is separate from observations and tracked business-map YAML.
172
+
173
+ `ProjectRegistrationService` validates the complete map through
174
+ `MapApplication` before storing its resolved root. A missing, invalid, or
175
+ unresolvable map therefore leaves the project file unchanged.
127
176
 
128
177
  ### LocalWebApplication And LocalWebServer
129
178
 
130
- `LocalWebApplication` reloads only the repository paths supplied by the CLI and
131
- renders the shared Viewer. `LocalWebServer` binds to `127.0.0.1`, serves GET and
132
- HEAD, rejects mutation methods, and accepts no repository path from HTTP. The
133
- server owns transport lifetime only; map loading, validation, layout, and HTML
134
- remain in their existing application and rendering owners. When allowed
135
- repositories share a basename, `ViewerPage` adds deterministic numeric labels
136
- without revealing parent or absolute paths.
179
+ `LocalWebApplication` turns one saved or explicit path set into a session-local
180
+ catalog with opaque project IDs. It renders the initial list without loading a
181
+ map and resolves a selected ID back to its server-only path for one
182
+ `MapApplication.viewerProject` call. Duplicate basenames receive deterministic
183
+ numeric labels without revealing parent or absolute paths. A project load
184
+ failure becomes a safe unavailable result and does not affect another project.
185
+
186
+ `LocalWebServer` binds to `127.0.0.1`, serves GET and HEAD, rejects mutation
187
+ methods, and accepts no repository path from HTTP. Its root serves the Viewer
188
+ shell and catalog; its opaque-ID project endpoint serves one current model and
189
+ SVG set with caching disabled. The server owns transport lifetime only; map
190
+ loading, validation, layout, and HTML remain in their existing owners.
137
191
 
138
192
  ### CLI
139
193
 
@@ -146,9 +200,12 @@ interpretation of its own.
146
200
  Owns the business-understanding workflow for every business-changing task. It
147
201
  activates from task meaning, converts a natural-language task into one bounded
148
202
  map probe, interprets advisory results or `MAP_NOT_FOUND`, builds the smallest
149
- current-evidence business model needed for the decision, and continues through
150
- the repository's normal implementation and verification process. Source editing
151
- and engineering judgment remain with the calling Agent.
203
+ current-evidence business model needed for the decision, traces relevant
204
+ business-flow branches before and after the change, and continues through the
205
+ repository's normal implementation and verification process. It classifies a
206
+ source/flow discrepancy before proposing either a code repair or a `flow`
207
+ maintenance candidate. Source editing and engineering judgment remain with the
208
+ calling Agent.
152
209
 
153
210
  The Skill invokes `context` through a small contract-checking adapter. The
154
211
  adapter prefers the CLI distributed with the Skill and accepts a PATH command
@@ -160,13 +217,14 @@ contract when another installed product uses the same executable name.
160
217
  Owns post-integration and periodic candidate triage after
161
218
  `ReconciliationService` has produced one read-only report. It selects one
162
219
  business domain, confirms proposed corrections against current source and
163
- tracked product meaning, resolves an existing or initial domain-owned YAML
164
- surface, leaves unresolved and implementation-local observations outside the
165
- canonical map, and submits any accepted correction as one normal reviewed YAML
166
- change. A `MAP_NOT_FOUND` repository can bootstrap one bounded domain when
167
- current evidence establishes its stable identity. Source confirmation, map
168
- editing, validation, rendering, Git diff, and independent review remain Agent
169
- and repository responsibilities rather than CLI side effects.
220
+ tracked product meaning, reconstructs `flow` candidates at business granularity,
221
+ resolves an existing or initial domain-owned YAML surface, leaves unresolved
222
+ and implementation-local observations outside the canonical map, and submits
223
+ any accepted correction as one normal reviewed YAML change. A `MAP_NOT_FOUND`
224
+ repository can bootstrap one bounded domain when current evidence establishes
225
+ its stable identity. Source confirmation, map editing, validation, rendering,
226
+ Git diff, and independent review remain Agent and repository responsibilities
227
+ rather than CLI side effects.
170
228
 
171
229
  The Skill keeps Work, Review, and Integration as separate evidence stages. Work
172
230
  prepares classifications and an observation document without consuming any
@@ -287,8 +345,11 @@ rather than local build effects.
287
345
  | --- | --- | --- | --- |
288
346
  | Business-map documents | Target repository | Git history | Normal reviewed file edit |
289
347
  | Parsed documents | One CLI invocation | Parse phase | Recreated from tracked files |
290
- | Normalized graph | One CLI invocation | Query/render phase | Recreated after validation |
348
+ | Normalized map with relationships and flows | One CLI invocation | Query/render phase | Recreated after validation |
291
349
  | Rendered output | Calling workflow | Reproducible artifact | Regenerated from the graph |
350
+ | Registered project paths | User home | Across Web sessions | Validated `project add` and atomic project-file replacement |
351
+ | Web project catalog | One local Web session | Server lifetime | Recreated from either registered or explicit paths |
352
+ | Current Web project model and SVG | Browser selection | Until the next selection | Loaded through one opaque server-assigned project ID |
292
353
  | Bundled Skill payloads | Installed npm package | Package version | Replaced only by exact package installation |
293
354
  | Managed user Skills | User home | Across repositories and CLI invocations | Per-Skill `semantic-atlas setup` atomic replacement |
294
355
  | Managed Skill markers | Managed Skill directories | Same as each installed payload | Written into each staged copy before activation |
@@ -321,7 +382,7 @@ application services
321
382
  filesystem, parser, CLI, and rendering adapters
322
383
  ```
323
384
 
324
- Domain contracts contain concept kinds, relation types, normalized graph
385
+ Domain contracts contain concept kinds, relation and flow types, normalized map
325
386
  objects, selectors, and query results. They do not import CLI, YAML, rendering,
326
387
  filesystem, Git, or framework types.
327
388
 
@@ -338,6 +399,7 @@ lifecycle commands:
338
399
  semantic-atlas validate [--repo <path>]
339
400
  semantic-atlas context <id-or-term> [--repo <path>]
340
401
  semantic-atlas render [--repo <path>] [--output <path>]
402
+ semantic-atlas project add [path]
341
403
  semantic-atlas web [--repo <path...>] [--port <port>] [--no-open]
342
404
  semantic-atlas setup
343
405
  semantic-atlas upgrade
@@ -351,16 +413,19 @@ semantic-atlas --version
351
413
  ```
352
414
 
353
415
  Map commands resolve and report the repository root and map-document set they
354
- used. `web` reports its loopback URL and repository count without exposing
355
- those roots to the browser. Observation commands report the derived repository
356
- identity, while package lifecycle commands remain repository-independent.
357
- Machine output uses a versioned envelope with a stable success or error
358
- discriminant.
416
+ used. `project add` defaults to the current directory, validates the complete
417
+ map, and reports `added` or `already_exists`. Parameterless `web` reads the
418
+ registered list; `web --repo` uses only its explicit temporary paths. `web`
419
+ reports its loopback URL and repository count without exposing roots to the
420
+ browser. Observation commands report the derived repository identity, while
421
+ package lifecycle commands remain repository-independent. Machine output uses
422
+ a versioned envelope with a stable success or error discriminant.
359
423
 
360
424
  `context` returns ambiguity when multiple concepts match the term. Callers can
361
425
  then use a stable ID. A missing concept is a bounded map result and routes the
362
426
  Agent to a bounded current-evidence business model; it is not a repository
363
- failure.
427
+ failure. A successful result includes every flow related through scenario
428
+ containment or direct step concept references.
364
429
 
365
430
  `setup`, `upgrade`, and `--version` do not discover a repository or load a
366
431
  business map. Their results expose the package version and managed Skill paths
@@ -390,12 +455,15 @@ checks:
390
455
  - at most one direct `part_of` parent per node;
391
456
  - acyclic `part_of` containment;
392
457
  - well-formed aliases and navigation anchors;
458
+ - unique scenario-owned flow identities and resolvable step references;
459
+ - valid action, decision, and outcome branch shape;
460
+ - reachability of every step from its flow entry while allowing cycles;
393
461
  - deterministic normalization independent of input file order.
394
462
 
395
463
  Validation does not claim that a path exists, a symbol still has the same name,
396
- or a business relation still matches current code. Those are task-time
397
- investigation questions. A separate advisory diagnostic may report obviously
398
- missing paths without changing graph validity.
464
+ or a business relation or flow still matches current behavior. Those are
465
+ task-time investigation questions. A separate advisory diagnostic may report
466
+ obviously missing paths without changing graph validity.
399
467
 
400
468
  ## Error Semantics
401
469
 
@@ -435,8 +503,16 @@ Errors fall into stable categories:
435
503
  summary.
436
504
  - `RECONCILIATION_READ_FAILED`: retained candidate and review evidence cannot
437
505
  produce a trustworthy reconciliation report.
438
- - `WEB_START_FAILED`: one of the explicitly selected repositories cannot load,
439
- the loopback port cannot bind, or the local Viewer cannot start.
506
+ - `PROJECT_CONFIG_INVALID`: the user-local project file violates its versioned
507
+ shape, normalized absolute-path rule, or uniqueness rule and remains unchanged.
508
+ - `PROJECT_CONFIG_STORAGE_FAILED`: the project file cannot be read or atomically
509
+ replaced; the previous complete file remains authoritative.
510
+ - `WEB_START_FAILED`: the registered list cannot be read, the loopback port
511
+ cannot bind, or the local Viewer cannot start.
512
+
513
+ A selected checkout that is missing or has an invalid map is a project-level
514
+ unavailable result, not `WEB_START_FAILED`. The HTTP response uses a safe
515
+ summary and never forwards a repository path or lower-level error message.
440
516
 
441
517
  Unexpected infrastructure errors propagate to the CLI boundary with a safe
442
518
  message and a nonzero exit status. The implementation adds contextual details
@@ -451,7 +527,8 @@ documents load.
451
527
 
452
528
  Ordinary feature branches read their branch's map revision. Durable changes use
453
529
  normal Git merge behavior. Review focuses on business meaning, stable IDs,
454
- relationship direction, and whether the update belongs in the shared map.
530
+ relationship direction, labeled branch outcomes, and whether the update belongs
531
+ in the shared map.
455
532
 
456
533
  Every business-changing task writes its own immutable observation and maintenance
457
534
  disposition. Candidate-producing results can enter post-integration maintenance
@@ -4,8 +4,9 @@ This page defines how the initial product proves that an advisory business map
4
4
  improves engineering accuracy and reduces routine human supervision. It applies
5
5
  to the CLI, renderer, Agent Skill, and real-project evaluation.
6
6
 
7
- **Status: accepted initial protocol; controlled Skill fixtures and the private
8
- real-project evaluation pass.**
7
+ **Status: accepted initial protocol; controlled relationship fixtures and the
8
+ private real-project evaluation pass. Business-flow behavior is covered by the
9
+ current source candidate and still needs longitudinal real-task evidence.**
9
10
 
10
11
  ## Evaluation Question
11
12
 
@@ -43,6 +44,13 @@ The agent identifies required incoming and outgoing collaborators, affected
43
44
  data, invariants, interfaces, tests, and asynchronous consumers. It avoids
44
45
  unsupported expansion into unrelated areas.
45
46
 
47
+ ### Business-path accuracy
48
+
49
+ For a task that intersects a retained flow, the agent identifies the affected
50
+ actions, decisions, labeled branches, and outcomes. A refactor preserves every
51
+ confirmed branch that remains part of the product behavior, while a deliberate
52
+ business change produces an explicit flow-maintenance decision.
53
+
46
54
  ### Evidence accuracy
47
55
 
48
56
  Every claim that controls the change is confirmed in current source, tests,
@@ -83,6 +91,8 @@ The first real-project suite contains at least:
83
91
  7. A contradicted-relation case where current evidence must override the map.
84
92
  8. A code-quality case where the first runnable implementation would create an
85
93
  unclear responsibility or unnecessary mechanism.
94
+ 9. A branch-sensitive refactor where a broad implementation still appears to
95
+ work but violates a retained business decision or outcome.
86
96
 
87
97
  Cases use real repository structure and behavior. Private business facts stay
88
98
  inside the private evaluation workspace and are summarized publicly only in
@@ -94,7 +104,9 @@ The public repository contains a de-identified miniature engineering system at
94
104
  `tests/fixtures/agent-skill/repository`. Its case contract covers an upstream
95
105
  root cause, an interface with a downstream consumer, missing map knowledge, an
96
106
  ambiguous term, a node without anchors, a stale anchor, and a relation that
97
- current source contradicts.
107
+ current source contradicts. The controlled Commerce map also contains one
108
+ authorization flow so contract tests prove that `context` returns relevant
109
+ scenario paths without treating them as current-source truth.
98
110
 
99
111
  Automated checks prove that each initial selector produces the intended public
100
112
  CLI outcome and that every acceptance oracle points to present source, test, or
@@ -140,6 +152,7 @@ The map file does not have to be repaired inside the engineering task.
140
152
  Each run records:
141
153
 
142
154
  - selected map nodes and relationships;
155
+ - related business flows and affected paths;
143
156
  - map statements used as investigation leads;
144
157
  - current files, tests, documents, or runtime evidence opened;
145
158
  - confirmed and contradicted map statements;
@@ -166,6 +179,8 @@ The initial product passes when:
166
179
  mechanical control produces no business-maintenance work;
167
180
  - required business boundaries and impact surfaces are identified in every
168
181
  case;
182
+ - each relevant flow is traced before and after the task, with confirmed
183
+ branches preserved or classified for maintenance;
169
184
  - implementation cases pass their behavioral tests and independent code-quality
170
185
  review;
171
186
  - map-assisted runs require no routine human correction after the task contract
package/docs/index.md CHANGED
@@ -14,7 +14,7 @@ verified gates.
14
14
  - [Architecture](architecture.md): stable responsibilities, lifecycle,
15
15
  dependency direction, collaboration model, and failure semantics.
16
16
  - [Map format](map-format.md): tracked graph documents, concepts, relations,
17
- anchors, validation, and query projections.
17
+ business flows, anchors, validation, and query projections.
18
18
  - [Accuracy observations](observations.md): task, independent-review, and
19
19
  maintenance evidence schemas, immutable local persistence, replay, privacy,
20
20
  derived summaries, and read-only actionable candidate reports.
@@ -1,8 +1,7 @@
1
1
  # Semantic Atlas Map Format
2
2
 
3
- This page defines the initial tracked document model, graph meaning, validation
4
- rules, and context projection. The implementation will publish a machine schema
5
- that follows this contract.
3
+ This page defines the tracked document model, relationship and flow meaning,
4
+ validation rules, and context projection.
6
5
 
7
6
  **Status: implemented by the `schemaVersion: 1` validation and context-query
8
7
  path.**
@@ -47,6 +46,8 @@ relations:
47
46
  type: part_of
48
47
  to: commerce
49
48
  summary: Orders is a durable Commerce capability.
49
+
50
+ flows: []
50
51
  ```
51
52
 
52
53
  Top-level `map` metadata identifies the owning document for diagnostics and
@@ -119,6 +120,86 @@ Relations describe durable business collaboration. They do not encode branch
119
120
  conditions, total order, retry behavior, loops, timing, or runtime execution
120
121
  state.
121
122
 
123
+ ## Business Flow Contract
124
+
125
+ A business flow describes one scenario's business-relevant actions,
126
+ decisions, labeled branches, and outcomes. It complements the relationship
127
+ graph: relations explain which concepts collaborate, while a flow explains how
128
+ one stable business path can reach different results.
129
+
130
+ ```yaml
131
+ flows:
132
+ - id: commerce.orders.place-order-flow
133
+ name: Place order
134
+ summary: Available stock becomes a reserved customer order.
135
+ scenario: commerce.orders.place-order
136
+ startsAt: check-inventory
137
+ steps:
138
+ - id: check-inventory
139
+ kind: decision
140
+ name: Is inventory available?
141
+ summary: Only available stock may proceed to order creation.
142
+ concept: commerce.orders.place-order.check-inventory
143
+ - id: create-order
144
+ kind: action
145
+ name: Create order
146
+ summary: The purchase becomes a durable customer order.
147
+ concept: commerce.orders.place-order.create-order
148
+ - id: order-placed
149
+ kind: outcome
150
+ name: Order placed
151
+ summary: The shopper receives a durable order.
152
+ concept: commerce.orders.order
153
+ - id: order-not-created
154
+ kind: outcome
155
+ name: Order not created
156
+ summary: Unavailable stock ends the attempt without an order.
157
+ transitions:
158
+ - from: check-inventory
159
+ when: available
160
+ to: create-order
161
+ - from: check-inventory
162
+ when: unavailable
163
+ to: order-not-created
164
+ - from: create-order
165
+ to: order-placed
166
+ ```
167
+
168
+ Each flow contains:
169
+
170
+ | Field | Required | Meaning |
171
+ | --- | --- | --- |
172
+ | `id` | yes | Stable repository-wide flow identity |
173
+ | `name` | yes | Human-facing scenario path name |
174
+ | `summary` | yes | Durable business result represented by the flow |
175
+ | `scenario` | yes | Existing `scenario` node that owns the flow |
176
+ | `startsAt` | yes | Entry step ID within the flow |
177
+ | `steps` | yes | One or more business-granularity steps |
178
+ | `transitions` | yes | Directed step connections and decision labels |
179
+ | `notes` | no | Durable qualification or known uncertainty |
180
+
181
+ Step kinds are:
182
+
183
+ - `action`: a meaningful business action with at most one unlabeled next step;
184
+ - `decision`: a business choice with at least two uniquely labeled branches;
185
+ - `outcome`: a business result that ends its path.
186
+
187
+ Each step has an ID unique within its flow, a name, a summary, and an optional
188
+ `concept` reference to an existing graph node. Referencing the same concept is
189
+ what lets the Viewer navigate from a relationship card into related flows;
190
+ there is no separately maintained link list.
191
+
192
+ Record a step when changing it can alter a user-visible result, durable data,
193
+ cost or provider usage, authorization or tenant isolation, an interface, or a
194
+ business outcome. Keep parameter validation, DTO conversion, helpers,
195
+ framework wiring, Service or Queue names, retries, and timing in current-source
196
+ evidence. Cycles are valid when the repeated business path itself is durable.
197
+
198
+ Flows remain advisory knowledge. A source discrepancy starts an investigation
199
+ into whether source regressed, product intent changed, the flow was already
200
+ stale, or available evidence is unresolved. It never synchronizes either side
201
+ automatically.
202
+
122
203
  ## Navigation Anchors
123
204
 
124
205
  Anchors help an agent enter the current repository. They are hints rather than
@@ -168,6 +249,13 @@ The complete repository map must satisfy:
168
249
  10. Aliases are unique for one node after case-insensitive normalization.
169
250
  11. Repository-relative anchors remain relative and normalized.
170
251
  12. Normalized graph order is deterministic across file discovery order.
252
+ 13. Flow IDs are repository-wide unique and each flow belongs to an existing
253
+ `scenario`.
254
+ 14. Step IDs are unique within a flow; `startsAt`, transition endpoints, and
255
+ optional concept references resolve.
256
+ 15. Actions have at most one unlabeled outgoing transition, decisions have at
257
+ least two uniquely labeled outgoing transitions, and outcomes have none.
258
+ 16. Every flow step is reachable from `startsAt`; cycles remain valid.
171
259
 
172
260
  Horizontal relation endpoints follow their business meaning:
173
261
 
@@ -209,7 +297,12 @@ For one selected node, `context` returns:
209
297
  - complete summaries for referenced endpoint nodes;
210
298
  - navigation anchors for all directly returned nodes;
211
299
  - the document IDs that supplied each item;
212
- - advisory anchor diagnostics when requested and available.
300
+ - advisory anchor diagnostics when requested and available;
301
+ - complete related flows, including steps and labeled transitions.
302
+
303
+ A flow is related when it belongs to the selected scenario, belongs to a
304
+ scenario under the selected domain or capability, or directly references the
305
+ selected operation, data, invariant, or interface from one of its steps.
213
306
 
214
307
  The result is intentionally local. The caller can query another returned stable
215
308
  ID when it needs to expand the investigation.
@@ -220,7 +313,8 @@ Agents edit the owning YAML file directly and use `semantic-atlas validate`
220
313
  before submitting a map change. Git diff is the review surface.
221
314
 
222
315
  Business-changing engineering tasks record observations outside the canonical
223
- map and create candidates only for stable meaning that needs maintenance.
316
+ map and create node, relation, anchor, or flow candidates only for stable
317
+ meaning that needs maintenance.
224
318
  Post-integration or periodic reconciliation confirms candidates in current
225
319
  evidence, updates one bounded neighborhood, validates the complete graph, and
226
320
  submits the normal repository change for review. A mapless repository can use
@@ -52,7 +52,9 @@ least one map query with one of these outcomes:
52
52
  Current-evidence dispositions are `confirmed`, `missing`, `stale`,
53
53
  `contradicted`, or `unresolved`. Each disposition and map-update candidate
54
54
  contains evidence references classified as source, test, tracked document, or
55
- runtime evidence. Candidate kinds are node, relation, and anchor. Every
55
+ runtime evidence. Candidate kinds are node, relation, anchor, and flow. A flow
56
+ candidate proposes a durable correction to a scenario's business actions,
57
+ decisions, labeled branches, or outcomes. Every
56
58
  candidate names its stable `businessDomainId` and carries a candidate-specific
57
59
  `confirmed`, `contradicted`, or `unresolved` disposition. Domain ownership and
58
60
  disposition are recorded explicitly because they cannot be inferred safely from