agent-doc-system 0.0.0-stage → 1.0.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 (117) hide show
  1. package/INSTALL_FOR_AGENTS.md +60 -0
  2. package/LICENSE +21 -0
  3. package/README.md +151 -2
  4. package/adapters/cache.mjs +27 -0
  5. package/adapters/contract-consumers.mjs +56 -0
  6. package/adapters/database.mjs +116 -0
  7. package/adapters/deploy-config.mjs +34 -0
  8. package/adapters/dockerfile.mjs +26 -0
  9. package/adapters/events.mjs +145 -0
  10. package/adapters/generic.mjs +86 -0
  11. package/adapters/github-actions.mjs +106 -0
  12. package/adapters/go.mjs +91 -0
  13. package/adapters/graphql.mjs +28 -0
  14. package/adapters/index.mjs +55 -0
  15. package/adapters/node.mjs +118 -0
  16. package/adapters/object-store.mjs +64 -0
  17. package/adapters/oidc.mjs +56 -0
  18. package/adapters/openapi.mjs +50 -0
  19. package/adapters/pnpm.mjs +42 -0
  20. package/adapters/protobuf.mjs +35 -0
  21. package/adapters/registry.mjs +27 -0
  22. package/adapters/resource-client.mjs +61 -0
  23. package/adapters/turborepo.mjs +135 -0
  24. package/adapters/typescript.mjs +85 -0
  25. package/adapters/wrangler.mjs +206 -0
  26. package/bin/agentdoc.mjs +478 -0
  27. package/bin/usage.txt +26 -0
  28. package/core/acceptances.mjs +69 -0
  29. package/core/audit.mjs +407 -0
  30. package/core/authority/classes.mjs +39 -0
  31. package/core/authority/engine.mjs +243 -0
  32. package/core/authority/facts.mjs +41 -0
  33. package/core/codes.mjs +119 -0
  34. package/core/compile.mjs +881 -0
  35. package/core/contracts.mjs +121 -0
  36. package/core/derive.mjs +102 -0
  37. package/core/descriptors.mjs +486 -0
  38. package/core/determinism.mjs +95 -0
  39. package/core/discover.mjs +147 -0
  40. package/core/facts.mjs +53 -0
  41. package/core/fsx.mjs +342 -0
  42. package/core/graph.mjs +260 -0
  43. package/core/impact.mjs +175 -0
  44. package/core/indexes.mjs +165 -0
  45. package/core/jsonschema.mjs +298 -0
  46. package/core/observations.mjs +129 -0
  47. package/core/provenance.mjs +83 -0
  48. package/core/query.mjs +384 -0
  49. package/core/relations.mjs +286 -0
  50. package/core/scaffold.mjs +322 -0
  51. package/core/secrets.mjs +92 -0
  52. package/core/sourcescan.mjs +88 -0
  53. package/core/toml.mjs +163 -0
  54. package/core/yaml.mjs +475 -0
  55. package/docs/ADAPTERS.md +172 -0
  56. package/docs/AUTHORITY.md +260 -0
  57. package/docs/CI.md +136 -0
  58. package/docs/COMPARISON-KODA.md +164 -0
  59. package/docs/EVALS.md +166 -0
  60. package/docs/MIGRATION.md +193 -0
  61. package/docs/PROVENANCE.md +133 -0
  62. package/docs/QUERY.md +180 -0
  63. package/docs/SPEC.md +339 -0
  64. package/docs/VERIFICATION.md +28 -0
  65. package/docs/ci/generic-ci.sh +28 -0
  66. package/docs/ci/github-actions.yml +35 -0
  67. package/evals/harness.mjs +426 -0
  68. package/evals/scenarios/fixture-a-01-change-api.json +9 -0
  69. package/evals/scenarios/fixture-a-02-change-db.json +9 -0
  70. package/evals/scenarios/fixture-a-03-enforce-constraint.json +9 -0
  71. package/evals/scenarios/fixture-b-01-change-proto.json +9 -0
  72. package/evals/scenarios/fixture-b-02-change-write-path.json +9 -0
  73. package/evals/scenarios/fixture-b-03-change-shared-lib.json +9 -0
  74. package/evals/scenarios/fixture-b-04-journey.json +9 -0
  75. package/evals/scenarios/fixture-c-01-mixed-runtime-edge.json +19 -0
  76. package/evals/scenarios/fixture-c-02-stale-doc-contradiction.json +9 -0
  77. package/evals/scenarios/fixture-c-03-shared-vocabulary.json +9 -0
  78. package/evals/scenarios/fixture-c-04-contract-change.json +9 -0
  79. package/evals/scenarios/koda-01-modify-api-consumer.json +26 -0
  80. package/evals/scenarios/koda-02-change-db-schema.json +20 -0
  81. package/evals/scenarios/koda-03-change-auth.json +21 -0
  82. package/evals/scenarios/koda-04-add-event-producer.json +19 -0
  83. package/evals/scenarios/koda-05-modify-worker-binding.json +25 -0
  84. package/evals/scenarios/koda-06-change-cross-component-endpoint.json +22 -0
  85. package/evals/scenarios/koda-07-change-shared-package.json +16 -0
  86. package/evals/scenarios/koda-08-change-runtime-cron.json +23 -0
  87. package/evals/scenarios/koda-09-debug-production-mismatch.json +26 -0
  88. package/evals/thresholds.json +11 -0
  89. package/package.json +46 -4
  90. package/schemas/api.schema.json +84 -0
  91. package/schemas/common.schema.json +107 -0
  92. package/schemas/component.schema.json +40 -0
  93. package/schemas/config.schema.json +685 -0
  94. package/schemas/domain.schema.json +14 -0
  95. package/schemas/graph.schema.json +1084 -0
  96. package/schemas/journeys.schema.json +47 -0
  97. package/schemas/observation.schema.json +143 -0
  98. package/schemas/resource.schema.json +28 -0
  99. package/schemas/system.schema.json +26 -0
  100. package/skills/agent-doc-system/SKILL.md +113 -0
  101. package/skills/agent-doc-system/references/authority-and-conflicts.md +70 -0
  102. package/skills/agent-doc-system/references/cli.md +89 -0
  103. package/skills/agent-doc-system/references/create-migrate.md +101 -0
  104. package/skills/agent-doc-system/references/maintenance.md +52 -0
  105. package/templates/ADR.md +26 -0
  106. package/templates/ARCHITECTURE.md +19 -0
  107. package/templates/CONSTRAINTS.md +17 -0
  108. package/templates/PRODUCT.md +17 -0
  109. package/templates/api.yaml +10 -0
  110. package/templates/ci.yml +31 -0
  111. package/templates/component.yaml +14 -0
  112. package/templates/domain.yaml +6 -0
  113. package/templates/journey.yaml +7 -0
  114. package/templates/observation.yaml +19 -0
  115. package/templates/resource.yaml +8 -0
  116. package/templates/system.yaml +10 -0
  117. package/templates/warning-acceptance.yaml +14 -0
@@ -0,0 +1,26 @@
1
+ # Architecture Decision Records
2
+
3
+ One file per decision: `NNNN-short-title.md`. An ADR records a decision and its
4
+ consequences, and is immutable once accepted — supersede it with a new ADR that
5
+ links back.
6
+
7
+ ## Template
8
+
9
+ # NNNN. Short title in one imperative sentence
10
+
11
+ ## Status
12
+ proposed | accepted | superseded by NNNN
13
+
14
+ ## Context
15
+ What was true before this decision. Facts, with evidence.
16
+
17
+ ## Decision
18
+ What was decided, in one sentence.
19
+
20
+ ## Consequences
21
+ What becomes easier, what becomes harder, and what is now forbidden.
22
+
23
+ ## Evidence class of each claim
24
+ Which parts are authored intent, which are derived from code, and which
25
+ were observed in a running system. Disagreement between them is the point
26
+ of this section, not a flaw in it.
@@ -0,0 +1,19 @@
1
+ # Architecture
2
+
3
+ This file explains *why the shape is what it is*. It does not enumerate
4
+ components, contracts or data stores: `agentdoc query` returns those from the
5
+ compiled graph, and a hand-maintained list would be wrong within a week.
6
+
7
+ ## How to read the system
8
+ - `agentdoc query <path>` for one component and its boundaries.
9
+ - `agentdoc impact <paths>` for what a change forces you to keep consistent.
10
+ - `agentdoc audit` for the current classification of every fact.
11
+
12
+ ## Structural decisions
13
+ <!-- One entry per decision, each linking to the ADR that records it. -->
14
+
15
+ ## Boundaries and why they exist
16
+ <!-- Which components may talk to which, and what enforces it. -->
17
+
18
+ ## Deliberate non-relationships
19
+ <!-- Things that look like they should be coupled and are not. -->
@@ -0,0 +1,17 @@
1
+ # Constraints
2
+
3
+ Repository-wide rules that an agent must not violate. Anything that is *not*
4
+ repository-wide belongs in the owning component's `CONSTRAINTS.md`, which the
5
+ graph routes to automatically.
6
+
7
+ ## Rule format
8
+ One rule, one imperative sentence, one reason. A rule that cannot be checked by
9
+ reading code or running a command belongs in an ADR, not here.
10
+
11
+ ## Rules
12
+ - <!-- rule -->
13
+ - Reason: <!-- why -->
14
+ - Checked by: <!-- command or test that proves it -->
15
+
16
+ ## Changing a rule
17
+ A rule change is an ADR. Record why the old rule stopped being true.
@@ -0,0 +1,17 @@
1
+ # Product
2
+
3
+ ## What this is
4
+ <!-- One paragraph. The product in the words a user would use. -->
5
+
6
+ ## Who it is for
7
+ <!-- The actors, and nothing else. -->
8
+
9
+ ## What it promises
10
+ <!-- The behaviours a user can rely on. Each one must be observable somewhere. -->
11
+
12
+ ## What it explicitly does not do
13
+ <!-- Non-goals. This section prevents more drift than any other. -->
14
+
15
+ ## Vocabulary
16
+ <!-- Domain terms and their exact meaning. Point at the Domain entity rather
17
+ than restating it: the graph already carries the definition. -->
@@ -0,0 +1,10 @@
1
+ apiVersion: agentdoc.dev/v1
2
+ kind: API
3
+ metadata:
4
+ name: example-api
5
+ description: "Canonical JSON HTTP surface served by the example component."
6
+ spec:
7
+ type: openapi
8
+ provider: component:default/example-service
9
+ contract:
10
+ ref: contracts/example.openapi.yaml
@@ -0,0 +1,31 @@
1
+ # Drift gate. The graph is a build artifact: compile it, then prove the
2
+ # committed one is byte-identical to a fresh compile. A stale or hand-edited
3
+ # graph fails here, not in someone's review three weeks later.
4
+ name: agentdoc
5
+ on:
6
+ pull_request:
7
+ push:
8
+ branches: [main]
9
+ jobs:
10
+ agentdoc:
11
+ runs-on: ubuntu-latest
12
+ timeout-minutes: 5
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with: { fetch-depth: 0 }
16
+ - uses: actions/setup-node@v4
17
+ with: { node-version: '24' }
18
+ - name: Install the agentdoc CLI
19
+ # Unpinned tracks main. For CI reproducibility pin a tag or commit:
20
+ # github:lbframe/agent-doc-system#v1.0.0
21
+ # A compiler upgrade intentionally invalidates committed graphs.
22
+ run: npm install -g github:lbframe/agent-doc-system
23
+ - name: Validate and compile
24
+ run: |
25
+ agentdoc validate
26
+ agentdoc compile
27
+ agentdoc check
28
+ - name: Reject dirty sources
29
+ run: agentdoc check --require-clean
30
+ - name: Routing evaluation
31
+ run: agentdoc eval routing
@@ -0,0 +1,14 @@
1
+ apiVersion: agentdoc.dev/v1
2
+ kind: Component
3
+ metadata:
4
+ name: example-service
5
+ description: "Serves the example read model for the example domain."
6
+ spec:
7
+ type: service
8
+ # Choose exactly one of system, domain, or placementRationale.
9
+ system: example-system
10
+ context:
11
+ docs:
12
+ - services/example-service/README.md
13
+ constraints:
14
+ - services/example-service/CONSTRAINTS.md
@@ -0,0 +1,6 @@
1
+ apiVersion: agentdoc.dev/v1
2
+ kind: Domain
3
+ metadata:
4
+ name: example-domain
5
+ description: "A bounded area of the product with its own vocabulary and rules."
6
+ spec: {}
@@ -0,0 +1,7 @@
1
+ schemaVersion: agentdoc.dev/journeys/v1
2
+ journeys:
3
+ - id: example-end-to-end
4
+ description: "One sentence describing the user-visible outcome this journey produces."
5
+ components:
6
+ - component:default/example-service
7
+ - component:default/example-consumer
@@ -0,0 +1,19 @@
1
+ apiVersion: agentdoc.dev/observation/v1
2
+ kind: ObservationSet
3
+ metadata:
4
+ name: production
5
+ description: "What the production platform reported for one observation window."
6
+ environment: production
7
+ capturedAt: "2026-01-01T00:00:00Z"
8
+ maxAgeDays: 30
9
+ sourceSystem: example-scheduler
10
+ collector: "example-cli schedules list --json"
11
+ evidenceBundle: agentdoc/observations/production/2026-01-01.json
12
+ provenance: "Collected during the scheduled change window; raw output committed verbatim."
13
+ spec:
14
+ facts:
15
+ - id: nightly-digest
16
+ subject: component:default/example-service
17
+ key: schedule.cron
18
+ value: "0 3 * * *"
19
+ semantics: "The expression the production scheduler actually evaluates for this trigger."
@@ -0,0 +1,8 @@
1
+ apiVersion: agentdoc.dev/v1
2
+ kind: Resource
3
+ metadata:
4
+ name: example-service-postgres
5
+ description: "Logical database owned by the example service."
6
+ spec:
7
+ type: logical-database
8
+ system: example-system
@@ -0,0 +1,10 @@
1
+ apiVersion: agentdoc.dev/v1
2
+ kind: System
3
+ metadata:
4
+ name: example-system
5
+ description: "Owns one responsibility inside the example domain."
6
+ spec:
7
+ domain: example-domain
8
+ context:
9
+ docs:
10
+ - docs/systems/example-system.md
@@ -0,0 +1,14 @@
1
+ # Warning acceptances live in agentdoc/agentdoc.config.yaml. Each one must carry
2
+ # the evidence content hashes as they are *now*; `agentdoc validate` recomputes
3
+ # them and fails when the evidence has moved, forcing a fresh review.
4
+ warningAcceptances:
5
+ - code: AGENTDOC_SERVICE_BINDING_UNRESOLVED
6
+ subject: component:default/example-service
7
+ classification: INTENDED_DIVERGENCE
8
+ reason: "This divergence is intentional and will be reconciled in Q3."
9
+ reviewWhen: "Review when the platform migration lands or the divergence persists past its stated window."
10
+ observedRefs:
11
+ - component:default/example-service
12
+ evidence:
13
+ - path: services/example-service/wrangler.toml
14
+ sha256: "0000000000000000000000000000000000000000000000000000000000000000"