@mytechtoday/augment-extensions 3.2.0 → 3.4.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 (198) hide show
  1. package/AGENTS.md +25 -16
  2. package/README.md +215 -17
  3. package/augment-extensions/coding-standards/java/CHANGELOG.md +12 -0
  4. package/augment-extensions/coding-standards/java/README.md +54 -0
  5. package/augment-extensions/coding-standards/java/examples/SearchRequest.java +13 -0
  6. package/augment-extensions/coding-standards/java/metadata.json +36 -0
  7. package/augment-extensions/coding-standards/java/module.json +35 -0
  8. package/augment-extensions/coding-standards/java/rules/language-and-api-design.md +45 -0
  9. package/augment-extensions/coding-standards/java/rules/reliability-and-concurrency.md +43 -0
  10. package/augment-extensions/coding-standards/java/rules/testing-tooling-and-security.md +39 -0
  11. package/augment-extensions/coding-standards/spring/CHANGELOG.md +12 -0
  12. package/augment-extensions/coding-standards/spring/README.md +61 -0
  13. package/augment-extensions/coding-standards/spring/examples/OrderController.java +40 -0
  14. package/augment-extensions/coding-standards/spring/metadata.json +39 -0
  15. package/augment-extensions/coding-standards/spring/module.json +38 -0
  16. package/augment-extensions/coding-standards/spring/rules/beans-configuration-and-boot.md +39 -0
  17. package/augment-extensions/coding-standards/spring/rules/data-testing-and-transactions.md +36 -0
  18. package/augment-extensions/coding-standards/spring/rules/production-operations.md +40 -0
  19. package/augment-extensions/coding-standards/spring/rules/web-apis-and-security.md +43 -0
  20. package/augment-extensions/visual-design/metadata.json +1 -1
  21. package/augment-extensions/visual-design/module.json +2 -2
  22. package/augment-extensions/workflows/agent-engineering/README.md +67 -0
  23. package/augment-extensions/workflows/agent-engineering/examples/contracts.cjs +89 -0
  24. package/augment-extensions/workflows/agent-engineering/examples/demo.cjs +17 -0
  25. package/augment-extensions/workflows/agent-engineering/examples/evaluation-cases.json +7 -0
  26. package/augment-extensions/workflows/agent-engineering/examples/graphs.cjs +149 -0
  27. package/augment-extensions/workflows/agent-engineering/examples/loop.cjs +125 -0
  28. package/augment-extensions/workflows/agent-engineering/examples/recovery.cjs +51 -0
  29. package/augment-extensions/workflows/agent-engineering/examples/stub.cjs +11 -0
  30. package/augment-extensions/workflows/agent-engineering/examples/verify.cjs +21 -0
  31. package/augment-extensions/workflows/agent-engineering/module.json +24 -0
  32. package/augment-extensions/workflows/agent-engineering/rules/01-adoption.md +30 -0
  33. package/augment-extensions/workflows/agent-engineering/rules/02-agents.md +34 -0
  34. package/augment-extensions/workflows/agent-engineering/rules/03-contracts.md +34 -0
  35. package/augment-extensions/workflows/agent-engineering/rules/04-loops.md +39 -0
  36. package/augment-extensions/workflows/agent-engineering/rules/05-graphs.md +39 -0
  37. package/augment-extensions/workflows/agent-engineering/rules/06-improvement.md +38 -0
  38. package/augment-extensions/workflows/agent-engineering/schemas/contracts.schema.json +1 -0
  39. package/augment-extensions/workflows/agent-engineering/scripts/validate.cjs +32 -0
  40. package/augment-extensions/workflows/agent-engineering/sources.md +12 -0
  41. package/augment-extensions/workflows/agent-engineering/templates/agent.json +40 -0
  42. package/augment-extensions/workflows/agent-engineering/templates/check-tool.json +94 -0
  43. package/augment-extensions/workflows/agent-engineering/templates/evidence.json +29 -0
  44. package/augment-extensions/workflows/agent-engineering/templates/invocation.json +40 -0
  45. package/augment-extensions/workflows/agent-engineering/templates/node.json +27 -0
  46. package/augment-extensions/workflows/agent-engineering/templates/state.json +27 -0
  47. package/augment-extensions/workflows/agent-engineering/templates/task.json +40 -0
  48. package/augment-extensions/workflows/agent-engineering/templates/tool.json +52 -0
  49. package/augment-extensions/workflows/cross-platform/README.md +120 -0
  50. package/augment-extensions/workflows/cross-platform/examples/end-to-end-session.md +196 -0
  51. package/augment-extensions/workflows/cross-platform/module.json +91 -0
  52. package/augment-extensions/workflows/cross-platform/rules/drift-resolution.md +126 -0
  53. package/augment-extensions/workflows/cross-platform/rules/export-guide.md +139 -0
  54. package/augment-extensions/workflows/cross-platform/rules/mcp-snippet-inlining.md +99 -0
  55. package/augment-extensions/workflows/cross-platform/rules/mirror-guide.md +139 -0
  56. package/augment-extensions/workflows/cross-platform/rules/windows-fallback.md +111 -0
  57. package/augment-extensions/workflows/decision-layer/README.md +172 -0
  58. package/augment-extensions/workflows/decision-layer/examples/call-inventory.json +6 -0
  59. package/augment-extensions/workflows/decision-layer/examples/config.json +9 -0
  60. package/augment-extensions/workflows/decision-layer/examples/decision.json +13 -0
  61. package/augment-extensions/workflows/decision-layer/examples/labeled-cases.json +410 -0
  62. package/augment-extensions/workflows/decision-layer/examples/source.txt +3 -0
  63. package/augment-extensions/workflows/decision-layer/examples/task.json +8 -0
  64. package/augment-extensions/workflows/decision-layer/installation/augx-judgments/SKILL.md +14 -0
  65. package/augment-extensions/workflows/decision-layer/installation/package-lock.json +27 -0
  66. package/augment-extensions/workflows/decision-layer/installation/package.json +7 -0
  67. package/augment-extensions/workflows/decision-layer/installation/sources.json +18 -0
  68. package/augment-extensions/workflows/decision-layer/module.json +24 -0
  69. package/augment-extensions/workflows/decision-layer/rules/00-index.md +5 -0
  70. package/augment-extensions/workflows/decision-layer/rules/01-responsibilities.md +15 -0
  71. package/augment-extensions/workflows/decision-layer/rules/02-operation.md +15 -0
  72. package/augment-extensions/workflows/decision-layer/runtime/automatic.cjs +80 -0
  73. package/augment-extensions/workflows/decision-layer/runtime/chat-install.cjs +149 -0
  74. package/augment-extensions/workflows/decision-layer/runtime/chat-server.cjs +71 -0
  75. package/augment-extensions/workflows/decision-layer/runtime/cli.cjs +70 -0
  76. package/augment-extensions/workflows/decision-layer/runtime/common.cjs +85 -0
  77. package/augment-extensions/workflows/decision-layer/runtime/contracts.d.ts +21 -0
  78. package/augment-extensions/workflows/decision-layer/runtime/decisions.cjs +198 -0
  79. package/augment-extensions/workflows/decision-layer/runtime/evaluate.cjs +61 -0
  80. package/augment-extensions/workflows/decision-layer/runtime/install.cjs +199 -0
  81. package/augment-extensions/workflows/decision-layer/runtime/integrations.cjs +64 -0
  82. package/augment-extensions/workflows/decision-layer/runtime/runner.cjs +201 -0
  83. package/augment-extensions/workflows/decision-layer/runtime/worker-child.cjs +15 -0
  84. package/augment-extensions/workflows/decision-layer/runtime/workers.cjs +15 -0
  85. package/augment-extensions/workflows/decision-layer/schemas/automatic-input.schema.json +40 -0
  86. package/augment-extensions/workflows/decision-layer/schemas/config.schema.json +39 -0
  87. package/augment-extensions/workflows/decision-layer/scripts/validate.cjs +16 -0
  88. package/augment-extensions/workflows/decision-layer/sources.md +34 -0
  89. package/cli/MODULES.md +804 -302
  90. package/cli/dist/__test_file-tracking.d.ts +2 -0
  91. package/cli/dist/__test_file-tracking.d.ts.map +1 -0
  92. package/cli/dist/__test_file-tracking.js +4 -0
  93. package/cli/dist/__test_file-tracking.js.map +1 -0
  94. package/cli/dist/analysis/ast-parser.d.ts.map +1 -1
  95. package/cli/dist/analysis/ast-parser.js +25 -9
  96. package/cli/dist/analysis/ast-parser.js.map +1 -1
  97. package/cli/dist/cli.js +43 -9
  98. package/cli/dist/cli.js.map +1 -1
  99. package/cli/dist/commands/context.d.ts +8 -0
  100. package/cli/dist/commands/context.d.ts.map +1 -0
  101. package/cli/dist/commands/context.js +115 -0
  102. package/cli/dist/commands/context.js.map +1 -0
  103. package/cli/dist/commands/decision.d.ts +4 -0
  104. package/cli/dist/commands/decision.d.ts.map +1 -0
  105. package/cli/dist/commands/decision.js +34 -0
  106. package/cli/dist/commands/decision.js.map +1 -0
  107. package/cli/dist/commands/gui-decision.d.ts +6 -0
  108. package/cli/dist/commands/gui-decision.d.ts.map +1 -0
  109. package/cli/dist/commands/gui-decision.js +210 -0
  110. package/cli/dist/commands/gui-decision.js.map +1 -0
  111. package/cli/dist/commands/gui-module-manager.d.ts +14 -0
  112. package/cli/dist/commands/gui-module-manager.d.ts.map +1 -0
  113. package/cli/dist/commands/gui-module-manager.js +328 -0
  114. package/cli/dist/commands/gui-module-manager.js.map +1 -0
  115. package/cli/dist/commands/gui.d.ts +3 -9
  116. package/cli/dist/commands/gui.d.ts.map +1 -1
  117. package/cli/dist/commands/gui.js +7 -293
  118. package/cli/dist/commands/gui.js.map +1 -1
  119. package/cli/dist/commands/link.d.ts +2 -0
  120. package/cli/dist/commands/link.d.ts.map +1 -1
  121. package/cli/dist/commands/link.js +82 -84
  122. package/cli/dist/commands/link.js.map +1 -1
  123. package/cli/dist/commands/search.js +1 -11
  124. package/cli/dist/commands/search.js.map +1 -1
  125. package/cli/dist/commands/show.d.ts.map +1 -1
  126. package/cli/dist/commands/show.js +5 -18
  127. package/cli/dist/commands/show.js.map +1 -1
  128. package/cli/dist/commands/skill.d.ts.map +1 -1
  129. package/cli/dist/commands/skill.js +3 -3
  130. package/cli/dist/commands/skill.js.map +1 -1
  131. package/cli/dist/commands/unlink.d.ts +2 -0
  132. package/cli/dist/commands/unlink.d.ts.map +1 -1
  133. package/cli/dist/commands/unlink.js +51 -45
  134. package/cli/dist/commands/unlink.js.map +1 -1
  135. package/cli/dist/commands/update.js +14 -7
  136. package/cli/dist/commands/update.js.map +1 -1
  137. package/cli/dist/core/compatibility-checker.d.ts.map +1 -1
  138. package/cli/dist/core/compatibility-checker.js +5 -2
  139. package/cli/dist/core/compatibility-checker.js.map +1 -1
  140. package/cli/dist/lib/context-hosts.d.ts +16 -0
  141. package/cli/dist/lib/context-hosts.d.ts.map +1 -0
  142. package/cli/dist/lib/context-hosts.js +395 -0
  143. package/cli/dist/lib/context-hosts.js.map +1 -0
  144. package/cli/dist/lib/context-refresh.d.ts +60 -0
  145. package/cli/dist/lib/context-refresh.d.ts.map +1 -0
  146. package/cli/dist/lib/context-refresh.js +630 -0
  147. package/cli/dist/lib/context-refresh.js.map +1 -0
  148. package/cli/dist/lib/module-resolver.d.ts.map +1 -1
  149. package/cli/dist/lib/module-resolver.js +2 -2
  150. package/cli/dist/lib/module-resolver.js.map +1 -1
  151. package/cli/dist/types/gui.d.ts +4 -0
  152. package/cli/dist/types/gui.d.ts.map +1 -1
  153. package/cli/dist/utils/coordination-queries.js +2 -2
  154. package/cli/dist/utils/coordination-queries.js.map +1 -1
  155. package/cli/dist/utils/decision-runner.d.ts +20 -0
  156. package/cli/dist/utils/decision-runner.d.ts.map +1 -0
  157. package/cli/dist/utils/decision-runner.js +114 -0
  158. package/cli/dist/utils/decision-runner.js.map +1 -0
  159. package/cli/dist/utils/extensions-config.d.ts.map +1 -1
  160. package/cli/dist/utils/extensions-config.js +3 -1
  161. package/cli/dist/utils/extensions-config.js.map +1 -1
  162. package/cli/dist/utils/extractCommandHelp.d.ts +2 -2
  163. package/cli/dist/utils/extractCommandHelp.d.ts.map +1 -1
  164. package/cli/dist/utils/extractCommandHelp.js +54 -24
  165. package/cli/dist/utils/extractCommandHelp.js.map +1 -1
  166. package/cli/dist/utils/file-tracking.js +5 -5
  167. package/cli/dist/utils/file-tracking.js.map +1 -1
  168. package/cli/dist/utils/glob-match.d.ts +6 -0
  169. package/cli/dist/utils/glob-match.d.ts.map +1 -0
  170. package/cli/dist/utils/glob-match.js +8 -0
  171. package/cli/dist/utils/glob-match.js.map +1 -0
  172. package/cli/dist/utils/gui-helpers.d.ts.map +1 -1
  173. package/cli/dist/utils/gui-helpers.js +7 -3
  174. package/cli/dist/utils/gui-helpers.js.map +1 -1
  175. package/cli/dist/utils/mcp-integration.d.ts.map +1 -1
  176. package/cli/dist/utils/mcp-integration.js +5 -7
  177. package/cli/dist/utils/mcp-integration.js.map +1 -1
  178. package/cli/dist/utils/module-system.d.ts +14 -0
  179. package/cli/dist/utils/module-system.d.ts.map +1 -1
  180. package/cli/dist/utils/module-system.js +39 -13
  181. package/cli/dist/utils/module-system.js.map +1 -1
  182. package/cli/dist/utils/modules-catalog.d.ts.map +1 -1
  183. package/cli/dist/utils/modules-catalog.js +5 -0
  184. package/cli/dist/utils/modules-catalog.js.map +1 -1
  185. package/cli/dist/utils/process.d.ts +14 -0
  186. package/cli/dist/utils/process.d.ts.map +1 -0
  187. package/cli/dist/utils/process.js +57 -0
  188. package/cli/dist/utils/process.js.map +1 -0
  189. package/cli/dist/utils/version.d.ts +2 -0
  190. package/cli/dist/utils/version.d.ts.map +1 -0
  191. package/cli/dist/utils/version.js +8 -0
  192. package/cli/dist/utils/version.js.map +1 -0
  193. package/cli/dist/utils/vscode-editor.d.ts.map +1 -1
  194. package/cli/dist/utils/vscode-editor.js +14 -8
  195. package/cli/dist/utils/vscode-editor.js.map +1 -1
  196. package/modules.md +85 -6
  197. package/package.json +36 -16
  198. package/scripts/check-wsl-augx.sh +63 -0
@@ -0,0 +1,99 @@
1
+ # MCP Snippet Inlining
2
+
3
+ ## What Gets Inlined
4
+
5
+ When `augx export` writes an aggregated file, it may inline a single tool-agnostic snippet describing how the consuming AI agent should query the **Beads MCP server** for live task state. The snippet body comes from `augment-extensions/workflows/mcp/templates/beads.md` and contains, at minimum:
6
+
7
+ - The server id (`beads`).
8
+ - The relevant public operations (`tasks/list`, `tasks/get`, `dependencies/list`, `status/get`).
9
+ - A reference to `augment-extensions/workflows/beads/` for the human-readable command guide.
10
+ - A directive that the consuming agent MUST query the MCP server for task context and NEVER rely on prose in the exported file.
11
+
12
+ The snippet contains **no** task IDs, statuses, dependency lists, endpoint URLs, secrets, or other live data. It is pure static guidance.
13
+
14
+ ## Trigger Condition
15
+
16
+ The snippet is inlined **only when** at least one of the following declares an MCP server with id `beads`:
17
+
18
+ - `.vscode/mcp.json`
19
+ - `.augment/mcp/servers.json`
20
+
21
+ When neither file exists, or neither declares the `beads` server, the snippet is omitted entirely. The exported file remains focused on the static module guidance and does not reference MCP at all.
22
+
23
+ This keeps the trigger explicit and auditable: presence of an MCP config that names `beads` is the sole signal.
24
+
25
+ ## Inlining Position
26
+
27
+ The snippet appears immediately after the generated banner (and, for Cursor, after the YAML frontmatter), before the first `## Module:` section header. Per-target adapters MAY wrap it in a single tool-specific line (e.g., a Cursor `> Note:` callout) but MUST NOT alter the substantive content.
28
+
29
+ ## What This Looks Like In Practice
30
+
31
+ `CLAUDE.md` (with `beads` declared in `.vscode/mcp.json`):
32
+
33
+ ```
34
+ <!-- GENERATED BY augx export - DO NOT EDIT -->
35
+ <!-- augx-version: 1.0.0 -->
36
+ <!-- generated-at: 2026-05-25T12:00:00.000Z -->
37
+ <!-- source-hash: a1b2c3d4e5f6a7b8 -->
38
+ <!-- modules: coding-standards/typescript@1.0.0, workflows/openspec@1.0.0 -->
39
+
40
+ ### Live Task Context via Beads MCP
41
+ ...
42
+
43
+ ## Module: coding-standards/typescript (v1.0.0)
44
+ ...
45
+ ```
46
+
47
+ `CLAUDE.md` (without `beads` declared anywhere):
48
+
49
+ ```
50
+ <!-- GENERATED BY augx export - DO NOT EDIT -->
51
+ <!-- augx-version: 1.0.0 -->
52
+ <!-- generated-at: 2026-05-25T12:00:00.000Z -->
53
+ <!-- source-hash: a1b2c3d4e5f6a7b8 -->
54
+ <!-- modules: coding-standards/typescript@1.0.0, workflows/openspec@1.0.0 -->
55
+
56
+ ## Module: coding-standards/typescript (v1.0.0)
57
+ ...
58
+ ```
59
+
60
+ The body bytes differ; the source hash will differ; the modules list is unchanged. Drift detection treats this correctly: removing the Beads MCP declaration and re-running `augx export` is a normal write, not a drift refusal.
61
+
62
+ ## Why MCP-First
63
+
64
+ The cross-platform feature is explicitly **MCP-first** for task context: exported files never embed live task data because:
65
+
66
+ 1. **Staleness**: a `bd-` ID baked into `CLAUDE.md` at export time may already be closed by the time an agent reads it.
67
+ 2. **Surface area**: spreading task data across four target files multiplies the surface where stale data can live.
68
+ 3. **Auditability**: a single MCP query point is far easier to audit than four divergent prose copies.
69
+ 4. **Privacy**: task descriptions sometimes contain sensitive references; the MCP server can scope responses, exported files cannot.
70
+
71
+ The static snippet is the agreed-upon "pointer", not the data itself.
72
+
73
+ ## When To Remove The Snippet
74
+
75
+ The snippet disappears from exported files on the next `augx export` run after either:
76
+
77
+ - The `beads` MCP server declaration is removed from both `.vscode/mcp.json` and `.augment/mcp/servers.json`.
78
+ - A future `--ignore-mcp` flag is passed to `augx export` (reserved for a later change, not in scope today).
79
+
80
+ ## Template Source
81
+
82
+ `augment-extensions/workflows/mcp/templates/beads.md` is the canonical template. It is versioned together with the `cross-platform` capability. Changes to the template (e.g., adding a new MCP operation like `comments/append`) cause the source hash to recompute on the next export run, which produces a normal write on every target.
83
+
84
+ ## What If A Project Declares A Different MCP Server?
85
+
86
+ Only the `beads` server triggers the snippet. A project may declare other MCP servers in `.vscode/mcp.json` or `.augment/mcp/servers.json` without affecting cross-platform export behavior. The trigger logic is a literal lookup for an entry whose key (or `id`) is `beads`; no fuzzy matching, no other server names recognized in this change.
87
+
88
+ Future capabilities may add per-server snippets (e.g., a `filesystem` MCP server template). Each would be opt-in and conditioned on its own declaration.
89
+
90
+ ## Validation
91
+
92
+ The template MUST satisfy a content check at build time (see `tests/mcp-template.test.ts`):
93
+
94
+ - Contains the string `Beads MCP server`.
95
+ - Contains all four operation names: `tasks/list`, `tasks/get`, `dependencies/list`, `status/get`.
96
+ - Contains NO `bd-` issue IDs.
97
+ - Contains NO status keywords used as data assertions.
98
+
99
+ This guarantees the snippet stays pure-guidance and never leaks data.
@@ -0,0 +1,139 @@
1
+ # `augx link --mirror` Day-to-Day Guide
2
+
3
+ ## Purpose
4
+
5
+ `augx link <module> --mirror <tool>[,<tool>...]` materializes one Augx module's `rules/` content into each target tool's **per-module** rules location, transparently and idempotently. The canonical source under `augment-extensions/` is never modified.
6
+
7
+ ## Grammar
8
+
9
+ ```
10
+ augx link <module> [--mirror <tool>[,<tool>...]] [--verbose]
11
+ ```
12
+
13
+ The pre-existing `augx link` behavior (resolve module, update coordination manifest, no per-tool materialization) is preserved when `--mirror` is omitted **and** `.augment/coordination.json.export.mirror` is not `true`.
14
+
15
+ ## Flags
16
+
17
+ | Flag | Default | Purpose |
18
+ |---|---|---|
19
+ | `--mirror` | none, or `export.mirror` from coordination.json when `true` | Comma-separated tool list: `claude-code`, `cursor`, `windsurf`, `copilot`. |
20
+ | `--force` | `false` | Overwrite drifted single-file mirrors after backing them up under `.augment/mirror-backups/`. |
21
+ | `--verbose` | `false` | Print the materialization mode (`symlink` vs `copy`) for each file. |
22
+
23
+ ## Per-Tool Target Paths
24
+
25
+ | Tool | Per-Module Destination |
26
+ |---|---|
27
+ | `claude-code` | `.claude/rules/<module>/...` (mirrors source layout) + one-line include stub appended to `CLAUDE.md` |
28
+ | `cursor` | `.cursor/rules/augx-<module>.mdc` (one file per module, frontmatter generated) |
29
+ | `windsurf` | `.windsurf/rules/augx-<module>.md` (one file per module) |
30
+ | `copilot` | `.github/instructions/augx-<module>.instructions.md` (one file per module) |
31
+
32
+ For Cursor, Windsurf, and Copilot, the per-module file is a concatenation of the module's `rules/*.md` content with a banner identical to the `augx export` banner, scoped to a single module.
33
+
34
+ For Claude Code, the source directory layout is preserved file-for-file under `.claude/rules/<module>/`, and `CLAUDE.md` receives an include stub:
35
+
36
+ ```
37
+ <!-- augx-include: .claude/rules/<module>/ -->
38
+ ```
39
+
40
+ When a single-file mirror already exists, augx compares its banner and body to the freshly rendered content before writing. Unmarked files and drifted files are refused unless `--force` is supplied. Forced overwrites first move the previous target into `.augment/mirror-backups/` so the prior state stays recoverable.
41
+
42
+ ## Materialization Strategy
43
+
44
+ For each rule file in the resolved module:
45
+
46
+ 1. Compute the destination path under the tool's convention.
47
+ 2. If `.augment/coordination.json.mirrors[<module>]` already records `mode: 'copy'` for that destination, skip directly to step 4.
48
+ 3. Try `symlink(source, destination)`.
49
+ 4. If symlink raises `EPERM`, `EACCES`, or `ENOSYS`, or succeeds but a subsequent read fails (Windows reparse misconfiguration), fall back to `copyFile(source, destination)`.
50
+ 5. Record `{ moduleId, tool, sourcePath, targetPath, mode: 'symlink' | 'copy' }` in `.augment/coordination.json.mirrors[<moduleId>]`.
51
+
52
+ See `windows-fallback.md` for the detailed Windows behavior.
53
+
54
+ ## Idempotency
55
+
56
+ On every invocation, the mirror hook computes the desired set of `(tool, targetPath)` tuples for the current module, compares against the tracked set in `mirrors[<module>]`, and reconciles:
57
+
58
+ | State | Action |
59
+ |---|---|
60
+ | Desired AND tracked AND same source | Leave alone. |
61
+ | Desired AND tracked AND different source | Update (re-symlink or re-copy). |
62
+ | Desired AND NOT tracked | Create. |
63
+ | NOT desired AND tracked | Prune (delete target, remove tracked entry). |
64
+
65
+ This guarantees that renaming, adding, or removing a module's rule files leaves the target tool's per-module rules clean and current with no stale artifacts.
66
+
67
+ ## Typical Workflows
68
+
69
+ ### Mirror a single module to one tool
70
+
71
+ ```bash
72
+ augx link coding-standards/typescript --mirror cursor
73
+ ```
74
+
75
+ Result:
76
+
77
+ ```
78
+ .cursor/rules/augx-typescript-standards.mdc
79
+ .augment/coordination.json.mirrors["coding-standards/typescript"] = [
80
+ { "tool": "cursor", "sourcePath": "...", "targetPath": ".cursor/rules/augx-typescript-standards.mdc", "mode": "symlink" }
81
+ ]
82
+ ```
83
+
84
+ ### Mirror to multiple tools at once
85
+
86
+ ```bash
87
+ augx link workflows/cross-platform --mirror claude-code,cursor,windsurf
88
+ ```
89
+
90
+ ### Default-mirror setup
91
+
92
+ Add to `.augment/coordination.json`:
93
+
94
+ ```json
95
+ {
96
+ "export": {
97
+ "targets": ["claude-code", "cursor"],
98
+ "mirror": true
99
+ }
100
+ }
101
+ ```
102
+
103
+ After this, `augx link <module>` (without `--mirror`) automatically mirrors into both `claude-code` and `cursor`. Use this when the project's policy is "always mirror everywhere by default".
104
+
105
+ ## Unlink Cleanup
106
+
107
+ ```bash
108
+ augx unlink <module>
109
+ ```
110
+
111
+ Reads `mirrors[<module>]` and, for each tracked entry:
112
+
113
+ 1. **Tracked symlink, still pointing to recorded source**: delete it.
114
+ 2. **Tracked copy, content matches recorded source hash**: delete it.
115
+ 3. **Hand-edited target** (content hash differs from recorded one): leave in place, emit a warning. User edits are never silently destroyed.
116
+
117
+ After processing, `mirrors[<module>]` is removed from the coordination manifest. For Claude Code, the include stub line is removed from `CLAUDE.md`.
118
+
119
+ If `mirrors` becomes empty after the unlink, the key itself is deleted from the manifest to keep the file clean.
120
+
121
+ ## Exit Codes
122
+
123
+ | Code | Meaning |
124
+ |---|---|
125
+ | 0 | Success (link + mirror complete) |
126
+ | 1 | Usage error (unknown tool name) |
127
+ | 2 | Module not found or unreadable |
128
+ | 4 | I/O error (permission denied, conflicting non-tracked file at destination) |
129
+
130
+ ## Safety Rules
131
+
132
+ - Never writes outside the project root.
133
+ - Never follows symlinks out of `augment-extensions/` while resolving sources.
134
+ - Refuses to overwrite a destination that exists and is neither a previously-tracked symlink nor a previously-tracked copy (exit 4); the conflicting path is reported.
135
+ - All stub content uses LF line endings and forward-slash paths.
136
+
137
+ ## Relationship to `augx export`
138
+
139
+ `augx export` produces one aggregated file per tool. `augx link --mirror` produces one file per module per tool. They write to disjoint paths (e.g., `.cursor/rules/augx.mdc` vs `.cursor/rules/augx-<module>.mdc`) and are safe to use together.
@@ -0,0 +1,111 @@
1
+ # Windows Symlink Fallback
2
+
3
+ ## TL;DR
4
+
5
+ On Windows, `fs.symlinkSync` requires administrator privileges or Developer Mode. When neither is available, the mirror hook automatically falls back to `copyFile`, records `mode: 'copy'` in the coordination manifest, and never retries `symlink` for that destination again.
6
+
7
+ No user action is required. This document explains the behavior contract so you know what to expect.
8
+
9
+ ## Detection
10
+
11
+ The mirror hook attempts a symlink first and catches a closed set of errnos:
12
+
13
+ | Errno | Meaning on Windows | Fallback? |
14
+ |---|---|---|
15
+ | `EPERM` | Not running elevated / Developer Mode off | Yes -> copyFile |
16
+ | `EACCES` | Permission denied on target directory | Yes -> copyFile |
17
+ | `ENOSYS` | Filesystem does not support symlinks (e.g., FAT32) | Yes -> copyFile |
18
+ | `EEXIST` | Destination already exists | No -> reconciled by idempotency rules |
19
+ | `ENOSPC` | Disk full | No -> re-thrown |
20
+ | any other | Unexpected | No -> re-thrown |
21
+
22
+ `copyFile` is invoked with the **same source and target arguments** that were passed to `symlink`. The chosen `mode` is then recorded in `.augment/coordination.json.mirrors[<module>][i].mode`.
23
+
24
+ ## Per-Run Behavior After Fallback
25
+
26
+ Once `mode: 'copy'` is recorded for a destination, the mirror hook **skips the symlink attempt** on subsequent runs and copies directly. This avoids:
27
+
28
+ - A retry storm: re-attempting symlink hundreds of times per `augx link` on a Windows machine without Developer Mode.
29
+ - Spurious EPERM noise in logs.
30
+ - Race conditions where the symlink half-succeeds, leaves a broken link, and then the copy lands.
31
+
32
+ To force a fresh attempt (e.g., after enabling Developer Mode), clear the `mode` field for that destination or run `augx unlink <module>` followed by `augx link <module> --mirror ...`.
33
+
34
+ ## Source Hash Validation
35
+
36
+ When `mode: 'copy'` is in effect, the mirror hook still revalidates the copy against the source hash on each re-link. If the source has changed, the destination is rewritten. The recorded `mode` only affects **how** the destination is materialized, not **whether** it is kept in sync.
37
+
38
+ ## What `augx unlink` Does With Copies
39
+
40
+ `augx unlink <module>` honors both modes:
41
+
42
+ | Tracked entry | Cleanup action |
43
+ |---|---|
44
+ | `mode: 'symlink'`, target is still that symlink | Delete the symlink. |
45
+ | `mode: 'symlink'`, target has been replaced by a regular file | Warn and leave in place. |
46
+ | `mode: 'copy'`, target content matches recorded source hash | Delete the copy. |
47
+ | `mode: 'copy'`, target has been hand-edited (hash mismatch) | Warn and leave in place. |
48
+
49
+ User edits are never silently destroyed, regardless of materialization mode.
50
+
51
+ ## Enabling Developer Mode (Optional)
52
+
53
+ On Windows 10/11, enabling Developer Mode lets a non-elevated process create symlinks:
54
+
55
+ 1. Settings -> Privacy & Security -> For developers
56
+ 2. Toggle "Developer Mode" on
57
+ 3. Restart the shell
58
+
59
+ After enabling, run `augx unlink <module>` and then `augx link <module> --mirror ...` to recreate the destinations as symlinks. Subsequent runs will record `mode: 'symlink'`.
60
+
61
+ If you cannot enable Developer Mode (corporate policy), the `copy` mode is fully supported and produces the same end-user experience; the only differences are disk usage (small) and update granularity (every re-link rewrites the file).
62
+
63
+ ## POSIX Behavior
64
+
65
+ On Linux and macOS, `fs.symlinkSync` succeeds for any user with write access to the parent directory. `mode: 'symlink'` is recorded. The fallback path is never exercised in normal operation.
66
+
67
+ ## Verification
68
+
69
+ To confirm the fallback worked on a specific destination:
70
+
71
+ ```bash
72
+ augx link <module> --mirror cursor --verbose
73
+ ```
74
+
75
+ Verbose output:
76
+
77
+ ```
78
+ cursor wrote symlink .cursor/rules/augx-<module>.mdc
79
+ ```
80
+
81
+ or
82
+
83
+ ```
84
+ cursor wrote copy .cursor/rules/augx-<module>.mdc
85
+ ```
86
+
87
+ The recorded mode is also visible directly in the manifest:
88
+
89
+ ```bash
90
+ cat .augment/coordination.json
91
+ # .mirrors["<module>"][...]"mode": "copy"
92
+ ```
93
+
94
+ ## Cross-Platform Invariants
95
+
96
+ The mirror hook guarantees these invariants regardless of the active mode:
97
+
98
+ - The destination's content equals the source's content after a successful link.
99
+ - A re-link of an unchanged module is a no-op (no rewrites, no symlink/copy churn).
100
+ - A re-link of a changed module updates the destination in place.
101
+ - `augx unlink` removes only tracked entries; hand-edited destinations survive.
102
+ - The coordination manifest is the single source of truth for what was materialized and how.
103
+
104
+ ## When `mode` Changes Between Runs
105
+
106
+ Recorded `mode` changes only when one of:
107
+
108
+ - `augx unlink` clears the entry and the next `augx link` is performed under different filesystem capabilities.
109
+ - A future `augx remirror` (not in this change's scope) explicitly requests re-materialization.
110
+
111
+ The mirror hook never silently flips an existing `'copy'` entry to `'symlink'` on its own. Stability across runs is more important than mode optimization.
@@ -0,0 +1,172 @@
1
+ # Decision Layer Workflow
2
+
3
+ ## Overview
4
+
5
+ An optional Augx runtime for TypeSafe judgments, code-owned policy, and durable local worker execution. Codex and Claude Code can also reach it through a native chat tool under saved automatic-use policy. Existing generative models retain planning, writing, coding, and argument generation. Jev returns judgments. Application code grants permissions, enforces limits, executes registered handlers, and verifies completion.
6
+
7
+ ## Installation
8
+
9
+ Run these commands from a consuming project using an Augx package containing this module:
10
+
11
+ ```bash
12
+ augx link workflows/decision-layer
13
+ augx decision setup --dry-run --host codex
14
+ augx decision setup --host codex
15
+ augx decision doctor
16
+ ```
17
+
18
+ Setup automatically installs the pinned official JavaScript SDK and official TypeSafe skill. The default skill host is Codex (`.agents/skills/typesafe-ai`); `--host claude-code` uses `.claude/skills/typesafe-ai`. The official documentation supports copying the complete skill directory manually. Setup performs that verified method with commit-pinned downloads and SHA-256 checks, including the license. It does not invoke a plugin marketplace or skills.sh as well.
19
+
20
+ Software lives in `.augx-decision/software`. Existing compatible Node 22+ with npm is reused. Otherwise setup downloads official Node 22.23.5, verifies its pinned archive checksum, extracts a separate runtime including npm, and invokes that executable explicitly. `--portable` forces this path. Supported distribution targets are Windows x64/arm64, macOS x64/arm64, and glibc Linux x64/arm64 with `/usr/bin/tar`. Other targets fail with a clear diagnostic. Actual platform verification is recorded in the implementation report. No administrator privilege, global upgrade, Python, database, or container is required.
21
+
22
+ Augx retains its declared Node 16 compatibility. Discovery, help, linking, exporting and mirroring neither load nor install the SDK. When the main CLI runs on Node 16, explicit decision execution launches the installed separate runtime. A source checkout needs `npm install` and `npm run build`; use `node cli/dist/cli.js` in place of `augx` to validate source changes. Installed packages contain compiled CLI code and module assets and need no TypeScript compiler for module setup.
23
+
24
+ The dry run detects platform, architecture, Node, npm, existing skill host directories and configuration scope without creating directories or downloading anything. Setup uses npm ci with an integrity-locked dependency, disables lifecycle scripts and audit, uses the explicit official registry, and excludes provider credentials from installer subprocesses. It writes a partial-install journal before installing and a hashed ownership receipt only after SDK loading and config validation. A failed or interrupted install can be retried. Existing edited software and skill files cause a preservation error. Existing valid config is retained. Offline setup works when compatible installed software and the skill are already present; missing downloads fail explicitly while offline. There is no offline bundle of the SDK or Node.
25
+
26
+ Doctor reports software installation, configuration validity, credential availability, connectivity verification, and live activation independently. Setup and offline validation need no credentials. Live calls use only `TYPESAFE_API_KEY` from the environment. Configure it using your shell or secret manager, never chat or a committed file. Inspect `.augx-decision/config.json`, enable `allowProviderData` for approved de-identified public/internal inputs, then explicitly request live operation:
27
+
28
+ ```bash
29
+ augx decision decide --input decision.json --live --requests 1 --id first-live-probe
30
+ ```
31
+
32
+ A successful live probe is connectivity evidence for that request only. Doctor never silently calls the provider and continues reporting connectivity as NOT VERIFIED. Explicit administrative live operations retain their per-invocation budget. Saved automatic-use policy is a separate opt-in described below. There is no fallback from live calls to fixtures.
33
+
34
+ ## Configure automatic chat judgments once
35
+
36
+ After reviewing data access and setting the existing environment credential locally, run:
37
+
38
+ ```bash
39
+ augx decision setup --host codex --automatic --requests 6 --dry-run
40
+ augx decision setup --host codex --automatic --requests 6
41
+ augx decision doctor
42
+ ```
43
+
44
+ Choose `--host claude-code` for Claude Code. The terminal GUI also provides **Configure automatic chat judgments once** and **Disable automatic chat judgments**. Automatic setup explicitly saves consent for selected de-identified public context, enables `allowProviderData`, installs the separate `augx-judgments` skill and registers the `augx_decision` MCP server with only `judge` pre-approved. It leaves the official TypeSafe skill unchanged. Existing automatic policy refinements are retained. Setup makes no provider calls and stores no keys. Internal data requires an explicit approved edit adding `internal` to `automatic.dataClasses`.
45
+
46
+ Restart the host in this project. Codex must trust the project to load `.codex/config.toml`; Claude Code must approve the project `.mcp.json` server once. Host and organization deny/ask rules remain authoritative. Setup does not change global host settings, trust an untrusted repository, or override a higher-priority policy. A shell or desktop host must inherit `TYPESAFE_API_KEY` from its launch environment. Project paths are absolute in the registration; rerun setup after moving the project or changing the package location.
47
+
48
+ During an ordinary task such as classifying an ambiguous report among categories, or ranking already accessible retrieved evidence, the host can implicitly select the skill and call the native MCP tool. The user need not mention Jev, run a terminal command, or approve each call already covered by saved host permission and runtime policy. The typed result returns to the same agent task flow as advice. Implicit model selection is host-controlled, not guaranteed on every eligible turn. No turn interceptor or message watcher is installed.
49
+
50
+ | Host | Native registration | Evidence and boundary |
51
+ |---|---|---|
52
+ | Codex | Project `.codex/config.toml`, `.agents/skills/augx-judgments/SKILL.md` | Installed Codex CLI accepted generated registration in an isolated trusted profile. Manual ordinary-chat selection remains NOT VERIFIED. |
53
+ | Claude Code | Project `.mcp.json`, `.claude/skills/augx-judgments/SKILL.md`, exact tool allow entry in `.claude/settings.local.json` | Installed Claude Code connected to the stdio server in an isolated approved profile. Manual ordinary-chat selection remains NOT VERIFIED. |
54
+ | Augment, Cursor, Windsurf, Copilot, hosted/cloud sessions | Existing static guidance only | No automatic runtime integration is claimed for these surfaces. |
55
+
56
+ The tool accepts only classification and retrieval ranking with two to eight described candidates, a short original goal, current revision and relevant evidence. Context fields are allowlisted strings. It reads no project files, full conversation or hidden reasoning. Greetings, exact lookups, arithmetic, obvious deterministic choices and self-evaluation of this tool are excluded by the skill. Unsupported, incomplete, disabled, unauthorized, oversized and secret-bearing inputs fail before requesting the provider. The runtime enforces saved capability and data-class lists. Existing host access controls determine which material the agent may supply; secret scanning is additional defense and cannot prove de-identification.
57
+
58
+ `automatic.requests` is a cumulative project ceiling, also capped by `limits.requests`, across conversations, processes, restarts, setup repetition and host changes. It has no automatic daily or per-turn reset. Increase the saved ceiling deliberately through setup to allocate more requests within the configured limit. The ledger retains only input digests, request count and reserved/answered/failed status. It stores no submitted context or provider results. A changed revision alone never causes another request for identical state. Changed evidence or candidates can be reconsidered if budget remains. One writer per project prevents concurrent overspending; busy requests return a fallback without queueing. A crash after reservation consumes that request and suppresses duplicate state.
59
+
60
+ Requests use the existing pinned SDK adapter, fixed endpoint/model, zero retries and the smaller of `automatic.timeoutMs` and `limits.requestMs`. Complete typed answers are validated before returning. Missing credentials/software, provider failures, malformed answers, cancellation, timeout, exhausted budget and unavailable writers return an explicit fallback with no answer. Continue existing deterministic work or review and report material failures. The MCP transport supports cancellation and aborts outstanding work on input close. A judgment executes no tool, grants no permissions and verifies no completion. There is no automatic fixture mode or credential/endpoint argument in the tool.
61
+
62
+ Doctor's `automatic` block separately reports saved enablement, registration integrity, request ceiling and consumed requests. Legacy `liveEnabled: false` means no explicit manual live operation is currently activated; it is not the automatic enablement field. `hostSession` and connectivity remain NOT VERIFIED until separately checked. See the [implementation evidence report](https://github.com/mytech-today-now/augment-extensions/blob/main/docs/reports/decision-chat-2026-11-27.md) for exact validation categories and acceptance gaps.
63
+
64
+ ```bash
65
+ augx decision setup --disable-automatic
66
+ ```
67
+
68
+ Disabling saves `automatic.enabled=false` before removing unchanged owned host entries and the companion skill. Unrelated host settings and edited owned files are retained. `augx decision remove` also disconnects tracked chat integration before removing software. The cumulative ledger is retained. `.augx-decision/chat-receipt.json` tracks only generated entry hashes and relative ownership paths. Partial activation remains disabled and retryable; inspect preserved-file errors locally, then rerun setup. Existing sessions may need restart to unload their tool, but disabled runtime policy prevents requests immediately.
69
+
70
+ ## Usage
71
+
72
+ Copy [source.txt](examples/source.txt), [task.json](examples/task.json), and [labeled-cases.json](examples/labeled-cases.json) into a disposable project after setup. The task and cases expect `source.txt` at the project root.
73
+
74
+ ```bash
75
+ augx decision examples --offline
76
+ augx decision run --input task.json --offline --id briefing
77
+ augx decision resume --id briefing --offline
78
+ augx decision evaluate --input labeled-cases.json --offline --id trial
79
+ augx decision inventory --input call-inventory.json
80
+ ```
81
+
82
+ The examples command executes all eleven capabilities. The run command dispatches, saves a local queue handoff, claims it, executes a real subprocess worker, writes its output, and independently verifies acceptance criteria and source digests. Built-in research collects supplied local evidence; write composes a draft from it; review produces a local inspection record. They do not search the web or call a generative model. Fixture routing is a deliberately simple lexical rule with explicit provenance. It provides repeatable runtime exercises, not evidence of Jev quality.
83
+
84
+ Use [decision.json](examples/decision.json) for an individual input. Every state requires original `goal`, nonnegative `revision`, and arrays for `evidence`, `completed`, `issues`, `constraints`, and `capabilities`. See [contracts](runtime/contracts.d.ts), [config schema](schemas/config.schema.json), and the executable examples for the supported narrow contracts. Unsupported fields never become executable commands or permissions.
85
+
86
+ ## Capabilities and actual integration boundary
87
+
88
+ | Capability | Runtime behavior and example |
89
+ |---|---|
90
+ | Model routing | Filters available compatible adapters by capabilities and data class, considers supplied cost information, then selects a generative adapter. `routeGeneration` invokes its registered generate method. |
91
+ | Tool assessment | Recommends allow/review/deny only after registered JSON Schema validation and caller authorization. `executeAction` checks authorization again before executing. CLI probes default to deny because they have no registered tool authority. |
92
+ | Context selection | Scores identified chunks in one batch, retains protected instructions/constraints/evidence/blockers, and returns selected, omitted and original views with source references. |
93
+ | Stuck detection | Combines progress and repetition Nouls with exact repeated-action and runtime no-progress limits. |
94
+ | Worker dispatch | Selects from currently available, capable registered workers; queues and consumes an actual local handler. |
95
+ | Action selection | Uses a revision-bound fresh menu and optional caller re-observation and argument validation. Selecting an identifier alone executes nothing. |
96
+ | Completion | Uses a Noul proposal plus a separate verifier callback. Missing evidence always produces review. Runs verify actual bytes independently of worker output. |
97
+ | Human escalation | Saves inspectable review.json; resume requires the exact review digest when approval is needed. Changed task, sources, policy or action invalidate approval. |
98
+ | Retrieval | Scores a supplied small corpus or uses `rerank` on up to 64 access-filtered results from an existing retriever, preserving references. No vector store added. |
99
+ | Trace evaluation | Batches satisfaction, efficiency and failure-category judgments. Evaluation records do not automatically alter production policy. |
100
+ | Input classification | Selects local destination criteria with a companion fit question and review fallback. Sends no messages. |
101
+
102
+ `augx decision examples --offline` is the executable example for each row. [Integrations](runtime/integrations.cjs) also implements scoped ancestor AGENTS.md loading, registered action schemas loaded on demand, existing generative-model adapter invocation, existing-retriever reranking, and bounded read-only file inspection. Context selection is query-dependent and reversible. Workers receive a scoped goal and source corpus and merge only their candidate artifact through the controller. Call read-only inspection or trace evaluation explicitly from your existing background runner when needed; no scheduler is installed.
103
+
104
+ A linked Markdown module cannot intercept an external coding agent. Explicit Augx calls, trusted programmatic adapters and the opt-in native MCP chat path above are separate entry points. The chat tool supplies advisory judgments and does not transparently wrap arbitrary providers, editors, tools or external recipients.
105
+
106
+ To connect an existing worker, call `run(root, policy, task, options)` from `runtime/runner.cjs` and supply `options.workers` containing trusted `{id, description, capabilities, available, modulePath, sha256}` registrations. Each fixed module exports `async execute(context)`, as [workers.cjs](runtime/workers.cjs) demonstrates. Registration comes from trusted application code, never a task or provider answer. The subprocess validates the module digest before loading it. Keep verifiers outside that module. Custom adapters must reconcile their own external receipts, idempotency and usage; the built-in verifier supports the local artifact contract only. No external generative-worker integration is claimed as tested here.
107
+
108
+ ## Policy, budgets, and recovery
109
+
110
+ Config pins `jev-1.14.0` and policy version `initial-1`. Choice/Score confidence and probabilities are validated separately. Actions use selected probability at or above the configured threshold and require it to exceed one-half, so ties always go to review. Noul uncertainty and contradictory answers have explicit review/error outcomes. Score bounds follow the descriptive rubric. Independent questions share state; dependent decisions need another observation and call.
111
+
112
+ Defaults: one active worker per run, three worker attempts, two no-progress rounds, twelve maximum provider requests, sixty seconds total run duration including downtime, five seconds per worker, ten seconds per provider request, and 24,000 serialized request bytes. The byte limit is deliberately more conservative than provider token limits; no exact tokenizer or long-context mode is claimed. SDK retries are disabled so one durable reservation permits at most one provider HTTP attempt. Failures consume reservations. Evaluation additionally reserves from one aggregate budget across all matched tasks. Different run identities are separate budgets.
113
+
114
+ Run state contains a schema version, task identity/digest, policy digest/version, observation revision, decision provenance, selected worker, status, attempts, request reservations, token usage where reported, artifacts, independent verification, and next action. Writes use flushed temporary files and same-directory rename. An exclusive per-run writer lock serializes claims and duplicate invocations. The lock records PID and ownership token; a live PID is never automatically displaced. A dead writer can be recovered with a second exclusive recovery claim. A leftover recovery claim requires manual inspection. PID reuse can conservatively block recovery.
115
+
116
+ Resume retains consumed budgets and the original deadline. It verifies an uncertain local artifact before retrying. Existing unverified artifacts require review and are not overwritten. Completed artifacts are rechecked and changed bytes invalidate completion. Crashed in-flight provider requests remain charged and go to review. Ctrl+C aborts requests and terminates owned worker processes and their normal process tree. Same-user hostile mutation, detached custom subprocesses, power-loss filesystem guarantees, exactly-once external effects, and OS sandboxing are outside this implementation's guarantees.
117
+
118
+ Review requests contain an action, concrete arguments, task/source digest, state revision and policy digest. After inspecting the file, explicitly authorize that concrete action:
119
+
120
+ ```bash
121
+ augx decision resume --id briefing --offline --approve DIGEST_FROM_REVIEW
122
+ ```
123
+
124
+ Approval resumes only the required registered worker and cannot authorize prohibited paths, a changed task, a different policy or missing capability. Do not modify state files to reset budgets. Use a new reviewed run identity for changed work. Exit 0 means the command succeeded, 1 means a run ended without verified completion, and 2 means invalid input, installation/provider failure, or ownership/configuration conflict.
125
+
126
+ Costs absent from SDK usage remain unknown (`null`), including worker charges and cache costs. Tokens are recorded only where reported; failed requests remain unknown. This module does not enforce a hard monetary spending cap. Use a provider-side spending limit where available and conservative request/duration reservations locally. A provider answer cannot grant data access or permission. Secret scanning is defense in depth; operators remain responsible for de-identification. Governing instructions are never filtered by a relevance score. Hidden model reasoning is never collected.
127
+
128
+ ## Removal and retention
129
+
130
+ ```bash
131
+ augx decision remove
132
+ augx unlink workflows/decision-layer
133
+ ```
134
+
135
+ Removal uses receipt allowlists and hashes, unlinks only unchanged recorded files, and preserves edited files, unrelated runtimes, credentials, run history, user data, and empty directories. Existing matching skill files reused from another installation are not owned. A redacted preservation receipt remains if edits need review. Remove retained run data manually only when you intend to discard it. A failed install without a ready receipt remains diagnostic rather than ready; rerun setup before removal.
136
+
137
+ ## Measurement and seven-day observation
138
+
139
+ Start with [call-inventory.json](examples/call-inventory.json). Choose its most frequent judgment for initial adoption. Probe representative de-identified state locally or in the provider playground before connecting a real worker. Run the 24 labeled cases, including held-out cases, then compare matched tasks using the same worker and verifier. The bundled cases are synthetic labels for runtime testing. Offline routing is simulated and does not prove model accuracy, provider performance, or savings. Labeling the task kind defines the required artifact contract; evaluation is not a blind benchmark. Replace cases with independently labeled held-out tasks and a real baseline adapter before making production quality claims.
140
+
141
+ Record independently verified completion rate, cost per completed task, end-to-end and provider latency, request reservations, worker attempts/retries, escalation rate, inappropriate escalations and missed escalations. Evaluation writes these fields with provenance and unavailable costs as null. Include routing overhead, worker time, provider charges and cache changes in real experiments. Trace judgments are separate observations and cannot overwrite artifact verification.
142
+
143
+ 1. Day 1: Inventory current calls, freeze baseline/policy/model versions, choose one judgment and de-identify representative traffic.
144
+ 2. Day 2: Inspect local probes, calibrate descriptions on the calibration split, and freeze a held-out split.
145
+ 3. Day 3: Run matched shadow tasks and inspect every escalation and independently verified completion.
146
+ 4. Day 4: Measure end-to-end latency and request/retry usage, including failed requests and worker work.
147
+ 5. Day 5: Reconcile actual provider and worker charges and cache effects; retain unavailable figures as unknown.
148
+ 6. Day 6: Evaluate held-out examples once, review inappropriate/missed escalations, and draft versioned policy recommendations.
149
+ 7. Day 7: Explicitly approve or reject promotion against measured completion, cost and latency. Retain the prior policy and expand one judgment at a time only with evidence.
150
+
151
+ No seven-day production observation has been performed by installing this module.
152
+
153
+ ## Contents and validation
154
+
155
+ - [Indexed rules](rules/00-index.md), [source notes](sources.md), [config schema](schemas/config.schema.json), [typed interface](runtime/contracts.d.ts)
156
+ - [Installer](runtime/install.cjs), [TypeSafe adapter](runtime/decisions.cjs), [controller](runtime/runner.cjs), [integration helpers](runtime/integrations.cjs), [evaluation](runtime/evaluate.cjs)
157
+ - [Pinned installation resources](installation/package.json), [source checksums](installation/sources.json), [example task](examples/task.json), [24 labeled cases](examples/labeled-cases.json)
158
+
159
+ ```bash
160
+ node augment-extensions/workflows/decision-layer/scripts/validate.cjs
161
+ npm run test:decision
162
+ ```
163
+
164
+ ## Character Count
165
+
166
+ The metadata count is the fixed-point sum of decoded file contents, including metadata, matching the maintained CLI method. Reconcile it with `scripts/validate.cjs --update-count` after edits. Runtime files stay outside rules, so exports and mirrors preserve their static-only contract.
167
+
168
+ ## Version
169
+
170
+ Module version: 1.1.0.
171
+
172
+ `npm run test:decision` explicitly installs the official SDK and skill into the ignored test-artifacts/decision-consumer-source prerequisite, then runs the existing Vitest harness. A plain Vitest run skips SDK and installation contract cases if this prerequisite is absent; it does not silently fake the SDK. The packed consumer verifier additionally exercises an actual clean package installation. To connect a custom worker that makes provider calls, declare `requestsPerAttempt` in its trusted registration. The controller reserves that allocation before launch and aggregates reported token usage. The worker must honor its allocation, report `usage.requests`, and reconcile external billing independently; unknown charges remain unknown. Offline mode never launches a worker with a positive provider-request allocation.
@@ -0,0 +1,6 @@
1
+ [
2
+ { "name": "plan feature", "kind": "generation", "callsPerDay": 20 },
3
+ { "name": "dispatch worker", "kind": "judgment", "callsPerDay": 200 },
4
+ { "name": "classify input", "kind": "judgment", "callsPerDay": 100 },
5
+ { "name": "check request budget", "kind": "deterministic", "callsPerDay": 300 }
6
+ ]
@@ -0,0 +1,9 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "policyVersion": "initial-1",
4
+ "model": "jev-1.14.0",
5
+ "allowProviderData": false,
6
+ "threshold": 0.85,
7
+ "relevance": 1.5,
8
+ "limits": { "requests": 12, "attempts": 3, "runMs": 60000, "workerMs": 5000, "requestMs": 10000, "noProgress": 2, "bytes": 24000 }
9
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "capability": "classify",
3
+ "state": {
4
+ "goal": "Route this local ticket: I need documentation for a draft briefing",
5
+ "revision": 1,
6
+ "evidence": ["A de-identified local ticket asks for documentation"],
7
+ "completed": [], "issues": [], "constraints": ["Do not send messages"], "capabilities": []
8
+ },
9
+ "candidates": [
10
+ { "id": "documentation", "description": "Requests for documentation and how-to guidance" },
11
+ { "id": "review", "description": "Ambiguous requests or destinations not covered by this menu" }
12
+ ]
13
+ }