@flancer32/skill-adsm-ctx 0.2.1

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 (132) hide show
  1. package/.github/workflows/flows-app.yaml +95 -0
  2. package/AGENTS.md +112 -0
  3. package/LICENSE +201 -0
  4. package/README.md +246 -0
  5. package/bin/cli.mjs +55 -0
  6. package/ctx/AGENTS.md +44 -0
  7. package/ctx/README.md +24 -0
  8. package/ctx/adsm.json +5 -0
  9. package/ctx/agent/AGENTS.md +41 -0
  10. package/ctx/agent/flows/.img/flancer32-skill-adsm-ctx-github-flows.png +0 -0
  11. package/ctx/agent/flows/AGENTS.md +37 -0
  12. package/ctx/agent/flows/cfg/issues/labeled/accepted/profile.json +25 -0
  13. package/ctx/agent/flows/cfg/issues/labeled/accepted/prompt.md +104 -0
  14. package/ctx/agent/flows/cfg/issues/labeled/clarification-provided/profile.json +15 -0
  15. package/ctx/agent/flows/cfg/issues/labeled/clarification-provided/prompt.md +63 -0
  16. package/ctx/agent/flows/cfg/issues/opened/admission/profile.json +14 -0
  17. package/ctx/agent/flows/cfg/issues/opened/admission/prompt.md +110 -0
  18. package/ctx/agent/flows/cfg/profile.json +40 -0
  19. package/ctx/agent/flows/cfg/pull_request/closed/merged/profile.json +15 -0
  20. package/ctx/agent/flows/cfg/pull_request/closed/merged/prompt.md +41 -0
  21. package/ctx/agent/flows/cfg/pull_request/labeled/needs-fix/profile.json +25 -0
  22. package/ctx/agent/flows/cfg/pull_request/labeled/needs-fix/prompt.md +79 -0
  23. package/ctx/agent/flows/cfg/pull_request/labeled/ready-for-validation/profile.json +15 -0
  24. package/ctx/agent/flows/cfg/pull_request/labeled/ready-for-validation/prompt.md +72 -0
  25. package/ctx/agent/flows/cfg/pull_request/labeled/verified/profile.json +15 -0
  26. package/ctx/agent/flows/cfg/pull_request/labeled/verified/prompt.md +48 -0
  27. package/ctx/agent/flows/deployment.md +116 -0
  28. package/ctx/agent/flows/labels.md +108 -0
  29. package/ctx/agent/flows/overview.md +82 -0
  30. package/ctx/agent/prompt/cli/ai-intro.md +141 -0
  31. package/ctx/assets/.gitkeep +1 -0
  32. package/ctx/docs/AGENTS.md +121 -0
  33. package/ctx/docs/ai-intro.md +37 -0
  34. package/ctx/docs/architecture/AGENTS.md +98 -0
  35. package/ctx/docs/architecture/behavior.md +68 -0
  36. package/ctx/docs/architecture/checklists.md +48 -0
  37. package/ctx/docs/architecture/constraints.md +53 -0
  38. package/ctx/docs/architecture/constraints.skin.en.md +38 -0
  39. package/ctx/docs/architecture/decisions.md +118 -0
  40. package/ctx/docs/architecture/integration.md +31 -0
  41. package/ctx/docs/architecture/overview.md +76 -0
  42. package/ctx/docs/architecture/state.md +50 -0
  43. package/ctx/docs/architecture/structure.md +38 -0
  44. package/ctx/docs/architecture/supervision.md +71 -0
  45. package/ctx/docs/code/AGENTS.md +51 -0
  46. package/ctx/docs/code/overview.md +53 -0
  47. package/ctx/docs/code/testing.md +26 -0
  48. package/ctx/docs/environment/AGENTS.md +50 -0
  49. package/ctx/docs/environment/overview.md +33 -0
  50. package/ctx/docs/filesystem.md +44 -0
  51. package/ctx/docs/product/AGENTS.md +51 -0
  52. package/ctx/docs/product/domain.md +63 -0
  53. package/ctx/docs/product/domain.skin.en.md +40 -0
  54. package/ctx/docs/product/glossary.md +31 -0
  55. package/ctx/docs/product/overview.md +112 -0
  56. package/ctx/docs/product/overview.skin.en.md +38 -0
  57. package/ctx/docs/product/roles.md +17 -0
  58. package/ctx/docs/product/use-cases.md +15 -0
  59. package/jsconfig.json +12 -0
  60. package/migrations/README.md +9 -0
  61. package/package.json +33 -0
  62. package/skill/SKILL.md +47 -0
  63. package/skill/references/agents-hierarchy.md +45 -0
  64. package/skill/references/context-lifecycle.md +53 -0
  65. package/skill/references/design-questionnaire.md +44 -0
  66. package/skill/references/document-projections.md +290 -0
  67. package/skill/references/documentation-compression.md +117 -0
  68. package/skill/references/documentation-quality-audit.md +199 -0
  69. package/skill/references/orchestration-model.md +41 -0
  70. package/skill/references/specialized-skills.md +31 -0
  71. package/skill/references/upgrade-policy.md +19 -0
  72. package/skill/templates/AGENTS.md +120 -0
  73. package/skill/templates/ai/AGENTS.md +59 -0
  74. package/skill/templates/ctx/AGENTS.md +45 -0
  75. package/skill/templates/ctx/README.md +27 -0
  76. package/skill/templates/ctx/adsm.json +7 -0
  77. package/skill/templates/ctx/agent/AGENTS.md +36 -0
  78. package/skill/templates/ctx/assets/.gitkeep +1 -0
  79. package/skill/templates/ctx/docs/AGENTS.md +55 -0
  80. package/skill/templates/ctx/docs/ai-intro.md +53 -0
  81. package/skill/templates/ctx/docs/architecture/AGENTS.md +42 -0
  82. package/skill/templates/ctx/docs/architecture/behavior.md +38 -0
  83. package/skill/templates/ctx/docs/architecture/checklists.md +25 -0
  84. package/skill/templates/ctx/docs/architecture/constraints.md +36 -0
  85. package/skill/templates/ctx/docs/architecture/decisions.md +33 -0
  86. package/skill/templates/ctx/docs/architecture/integration.md +27 -0
  87. package/skill/templates/ctx/docs/architecture/overview.md +73 -0
  88. package/skill/templates/ctx/docs/architecture/state.md +52 -0
  89. package/skill/templates/ctx/docs/architecture/structure.md +32 -0
  90. package/skill/templates/ctx/docs/architecture/supervision.md +61 -0
  91. package/skill/templates/ctx/docs/code/AGENTS.md +35 -0
  92. package/skill/templates/ctx/docs/code/overview.md +21 -0
  93. package/skill/templates/ctx/docs/code/testing.md +13 -0
  94. package/skill/templates/ctx/docs/environment/AGENTS.md +34 -0
  95. package/skill/templates/ctx/docs/environment/overview.md +21 -0
  96. package/skill/templates/ctx/docs/filesystem.md +39 -0
  97. package/skill/templates/ctx/docs/product/AGENTS.md +38 -0
  98. package/skill/templates/ctx/docs/product/domain.md +77 -0
  99. package/skill/templates/ctx/docs/product/glossary.md +110 -0
  100. package/skill/templates/ctx/docs/product/overview.md +74 -0
  101. package/skill/templates/ctx/docs/product/roles.md +100 -0
  102. package/skill/templates/ctx/docs/product/use-cases.md +109 -0
  103. package/skill/templates/work/context/semantic-skin.md +27 -0
  104. package/skill/templates/work/report/documentation-compression.md +34 -0
  105. package/skill/templates/work/report/documentation-quality-audit.md +90 -0
  106. package/src/Bootstrap/Cli.mjs +62 -0
  107. package/src/Bootstrap.mjs +108 -0
  108. package/src/Design/Service.mjs +36 -0
  109. package/src/Init/Service.mjs +136 -0
  110. package/src/Shared/Constants.mjs +36 -0
  111. package/src/Shared/CopyDirectory.mjs +78 -0
  112. package/src/Shared/Metadata.mjs +30 -0
  113. package/src/Shared/Path.mjs +38 -0
  114. package/src/Skill/Installer.mjs +47 -0
  115. package/src/Upgrade/Service.mjs +44 -0
  116. package/src/Validate/Service.mjs +879 -0
  117. package/test/integration/.gitkeep +1 -0
  118. package/test/integration/cli-help.test.mjs +15 -0
  119. package/test/integration/cli-init-validate.test.mjs +223 -0
  120. package/test/integration/cli-install-skill.test.mjs +41 -0
  121. package/test/unit/Bootstrap/Cli.test.mjs +23 -0
  122. package/test/unit/Bootstrap.test.mjs +53 -0
  123. package/test/unit/Design/Service.test.mjs +11 -0
  124. package/test/unit/Init/Service.test.mjs +51 -0
  125. package/test/unit/Shared/Constants.test.mjs +21 -0
  126. package/test/unit/Shared/CopyDirectory.test.mjs +31 -0
  127. package/test/unit/Shared/Metadata.test.mjs +9 -0
  128. package/test/unit/Shared/Path.test.mjs +11 -0
  129. package/test/unit/Skill/Installer.test.mjs +20 -0
  130. package/test/unit/Upgrade/Service.test.mjs +13 -0
  131. package/test/unit/Validate/Service.test.mjs +760 -0
  132. package/types.d.ts +15 -0
@@ -0,0 +1,118 @@
1
+ # Architecture Decisions
2
+
3
+ - Path: `ctx/docs/architecture/decisions.md`
4
+ - Changed: `20260813`
5
+
6
+ ## Purpose
7
+
8
+ Records durable architecture decisions for the skill product.
9
+
10
+ ## A1. Generic Orchestration First
11
+
12
+ Decision:
13
+ The skill stays generic and manages cognitive-context lifecycle rather than project-specific implementation domains.
14
+
15
+ Rejected alternative:
16
+ Encode browser, backend, deployment, or domain-specific architecture directly into the baseline skill.
17
+
18
+ Reasoning:
19
+ Project specialization belongs in dedicated skills or project context, not in the generic lifecycle baseline.
20
+
21
+ ## A2. Architecture Is A Separate Level
22
+
23
+ Decision:
24
+ Architecture remains a distinct documentation level between product and environment.
25
+
26
+ Rejected alternative:
27
+ Fold structural guidance into product documents or jump directly from product documents to code-oriented constraints.
28
+
29
+ Reasoning:
30
+ The working group needs a stable place for engineering boundaries, state ownership, integrations, and supervision rules.
31
+
32
+ ## A3. Live Context And Installed Templates Stay Separate
33
+
34
+ Decision:
35
+ This repository's own `ctx/` documents the product, while `skill/templates/ctx/` provides reusable starter context for other projects.
36
+
37
+ Rejected alternative:
38
+ Treat the repository context and the installable template payload as the same artifact.
39
+
40
+ Reasoning:
41
+ The product needs self-documentation and reusable output, but those artifacts serve different consumers and change for different reasons.
42
+
43
+ ## A4. Documentation Precedes Structural Change
44
+
45
+ Decision:
46
+ New architectural concepts are documented before downstream code or environment changes.
47
+
48
+ Rejected alternative:
49
+ Allow architecture to emerge only from implementation diffs.
50
+
51
+ Reasoning:
52
+ ADSM uses documentation as an operational interface; architecture drift must be visible before it is encoded.
53
+
54
+ ## A5. Boundary Expansion Requires Human Approval
55
+
56
+ Decision:
57
+ Agents may refine architecture inside existing guardrails, but expanding owners, persistent state, integrations, or system boundaries requires human approval.
58
+
59
+ Rejected alternative:
60
+ Permit autonomous architectural expansion when implementation seems straightforward.
61
+
62
+ Reasoning:
63
+ Those changes alter the supervision burden and must remain under human control.
64
+
65
+ ## A6. Documentation Quality Audit Is Agent-Guided
66
+
67
+ Decision:
68
+ Documentation quality audit is implemented as agent guidance over the declarative project documentation corpus under `ctx/docs/`, not as CLI semantic scoring.
69
+
70
+ Rejected alternative:
71
+ Encode documentation quality scoring as an automatic CLI validation command over the whole cognitive context.
72
+
73
+ Reasoning:
74
+ The quality criteria require semantic reading, evidence-backed findings, and separation of editorial issues from missing human decisions. Operational context such as agent workflows, prompts, and runtime configuration may exist under `ctx/`, but it is not part of the default documentation quality corpus.
75
+
76
+ ## A7. Documentation Compression Is Controlled Rewrite
77
+
78
+ Decision:
79
+ Documentation compression is implemented as agent guidance over the declarative project documentation corpus under `ctx/docs/`, not as automatic semantic scoring or broad context rewriting.
80
+
81
+ Rejected alternative:
82
+ Let compression freely summarize the whole cognitive context or treat operational context as part of the default corpus.
83
+
84
+ Reasoning:
85
+ Compression changes text directly and therefore needs stronger authority discipline than audit. The default scope remains `ctx/docs/`, and accepted project meaning must be preserved while redundancy and low-density wording are reduced.
86
+
87
+ ## A8. Agent/Skin Projection Defines Document Control
88
+
89
+ Decision:
90
+ Documents under `ctx/docs/**` are agent-facing operational context documents by default, and human semantic control is expressed through optional matching `*.skin.<lang>.md` files.
91
+
92
+ Rejected alternative:
93
+ Use document metadata markers as the primary semantic-control mechanism.
94
+
95
+ Reasoning:
96
+ The working model of this product is one human and many agents. Agent-first is the normal operating mode, but human control needs a stronger semantic projection than a metadata marker. A `*.skin.<lang>.md` file provides an explicit control surface for the matching agent document without turning that document into a human-oriented summary.
97
+
98
+ ## A9. The Skill Enforces ADSM Discipline
99
+
100
+ Decision:
101
+ Project documentation templates should focus on governing a project, while ADSM conformance rules are enforced by the skill itself.
102
+
103
+ Rejected alternative:
104
+ Embed most ADSM discipline directly into project-facing document templates and make project documents explain the methodology to themselves.
105
+
106
+ Reasoning:
107
+ Project cognitive context should spend attention on product and architecture control, not on repeated methodological self-description. Installed templates should carry only the minimal bootstrap signal that the context follows ADSM and that structural validation belongs to skill `adsm-ctx`. The skill is the correct place for template discipline, audit logic, compression rules, and other ADSM conformance checks.
108
+
109
+ ## A10. `AGENTS.md` Is A Control Surface, Not A Spec Origin
110
+
111
+ Decision:
112
+ `AGENTS.md` files are service control files for agent work. Their own requirements originate in declarative documents under `ctx/docs/`, then are operationalized by the skill.
113
+
114
+ Rejected alternative:
115
+ Let `AGENTS.md` files define the normative rules for the `AGENTS.md` hierarchy, structure, and authoring format by themselves.
116
+
117
+ Reasoning:
118
+ Allowing `AGENTS.md` to legislate its own format mixes specification with execution control. The specification layer must stay in `ctx/docs/`; the skill may then detail and validate it; individual `AGENTS.md` files only execute that already-declared model in local project work.
@@ -0,0 +1,31 @@
1
+ # Architecture Integration
2
+
3
+ - Path: `ctx/docs/architecture/integration.md`
4
+ - Changed: `20260707`
5
+
6
+ ## Purpose
7
+
8
+ Defines the major integration boundaries of the skill product.
9
+
10
+ ## External Integrations
11
+
12
+ - local project filesystem — target of context initialization, validation, and upgrade work;
13
+ - package installation environment — distribution surface for the CLI and reusable templates;
14
+ - agent skill host — installation target for the bundled skill payload;
15
+ - source-control workflow — durable channel for reviewing and propagating template changes.
16
+
17
+ ## Internal Contracts
18
+
19
+ - lifecycle operations consume declared repository context before making structure decisions;
20
+ - reusable templates provide the baseline artifact set for initialized projects;
21
+ - skill installation connects the CLI `install-skill` command, the source `skill/` payload, and the caller-provided skills root;
22
+ - documentation quality audit guidance connects the source prompt in `skill/references/documentation-quality-audit.md`, the working report template in `skill/templates/work/report/`, and agent-produced audit reports;
23
+ - documentation compression guidance connects the source prompt in `skill/references/documentation-compression.md`, the working report template in `skill/templates/work/report/`, and agent-produced compression reports;
24
+ - repository `ctx/` documents the product and governs changes to templates and implementation;
25
+ - specialization routing hands project-specific architecture work to dedicated skills when they exist.
26
+
27
+ ## Integration Boundaries
28
+
29
+ - This document defines contract surfaces, not endpoint schemas or DTOs.
30
+ - External integrations must remain explicit in architecture before they appear in implementation.
31
+ - New integrations that affect project boundaries require supervision updates and human approval.
@@ -0,0 +1,76 @@
1
+ # Architecture Overview
2
+
3
+ - Path: `ctx/docs/architecture/overview.md`
4
+ - Changed: `20260708`
5
+
6
+ ## Purpose
7
+
8
+ Defines architecture-level orientation for this skill product.
9
+
10
+ ## Architecture Role
11
+
12
+ At this level, product intent is translated into stable engineering structure.
13
+
14
+ This level answers:
15
+
16
+ - what is structurally built;
17
+ - how the system behaves internally;
18
+ - where state is owned;
19
+ - what integrations exist;
20
+ - what constraints must not be violated;
21
+ - why key architectural decisions were made;
22
+ - how human and agents supervise architectural consistency.
23
+
24
+ This document answers those questions briefly and identifies the related architecture documents that hold more detail.
25
+
26
+ ## Architectural Style
27
+
28
+ The product uses a documentation-first lifecycle architecture with separate surfaces for lifecycle execution, guidance, reusable templates, and supervision.
29
+
30
+ ## Major Areas
31
+
32
+ - lifecycle orchestration for `init`, `design`, `validate`, `quality-audit`, `documentation-compression`, and `upgrade`;
33
+ - skill payload installation for agent skill hosts;
34
+ - agent-facing audit and compression guidance;
35
+ - semantic-skin-ready control surfaces for orientation, constraints, and checklists;
36
+ - reusable product-level and architecture-level context templates;
37
+ - reserved `ctx/agent/` boundary for project-local materials outside ADSM methodology;
38
+ - repository context that governs the package itself;
39
+ - migration and validation boundaries that preserve project-specific content;
40
+ - specialization routing boundary.
41
+
42
+ ## Related Bodies
43
+
44
+ - Read `structure.md` when the question is "what are the main architectural areas and boundaries?"
45
+ - Read `behavior.md` when the question is "how do those areas work together through major internal flows?"
46
+ - Read `checklists.md` when the question is "which fast human checks should I run before concluding that agent work drifted?"
47
+ - Read `state.md` when the question is "where is authoritative state owned, persisted, changed, and derived?"
48
+ - Read `integration.md` when the question is "which external systems and internal contract boundaries matter?"
49
+ - Read `constraints.md` when the question is "which architectural options are forbidden or non-negotiable?"
50
+ - Read `decisions.md` when the question is "why was this architecture chosen over other durable alternatives?"
51
+ - Read `supervision.md` when the question is "what may agents change, what requires approval, and what signals drift?"
52
+
53
+ ## Product Dependency
54
+
55
+ This level depends on product documentation.
56
+
57
+ Product documentation defines what this skill is and what it is responsible for.
58
+
59
+ Architecture defines how that product intent is realized structurally.
60
+
61
+ The expected dependency is:
62
+
63
+ ```text
64
+ product
65
+ → architecture
66
+ → environment
67
+ → code
68
+ ```
69
+
70
+ Architecture must not redefine product meaning, invent missing product behavior, or normalize product contradictions silently.
71
+
72
+ ## Human-Agent Use
73
+
74
+ The architecture level is an operational interface between one human and many agents.
75
+
76
+ The human owns direction and guardrails. Agents may refine architecture within those guardrails and must report drift instead of deciding past the declared boundary.
@@ -0,0 +1,50 @@
1
+ # Architecture State
2
+
3
+ - Path: `ctx/docs/architecture/state.md`
4
+ - Changed: `20260707`
5
+
6
+ ## Purpose
7
+
8
+ Defines state ownership and sources of truth for the skill product.
9
+
10
+ ## Sources Of Truth
11
+
12
+ - `ctx/` is the declarative source of truth for this repository as a product.
13
+ - `skill/` is the source of truth for the installed agent skill payload.
14
+ - `skill/templates/ctx/` is the source of truth for installed starter context artifacts and their minimal ADSM bootstrap markers.
15
+ - `skill/templates/work/` is the source of truth for working templates used by agents during skill operations.
16
+ - `ctx/adsm.json` is the durable metadata source for context versioning and upgrade eligibility.
17
+
18
+ ## State Categories
19
+
20
+ - authoritative durable state — versioned context documents, templates, metadata, and repository content that define the product and its reusable baseline;
21
+ - derived state — installed copies, validation findings, and generated reports that are produced from authoritative durable state;
22
+ - transient state — process-local execution data used during a command or agent run.
23
+
24
+ ## Ownership Boundaries
25
+
26
+ - `ctx/` owns the declared meaning and architectural rules of this repository as a product.
27
+ - `skill/` owns the installable agent-consumed skill payload.
28
+ - `skill/templates/ctx/` owns the reusable baseline to be installed into downstream projects, including the minimal markers that route structural validation back to the skill.
29
+ - `skill/templates/work/` owns reusable working output structures that are not installed into project `ctx/` by default.
30
+ - `ctx/adsm.json` owns durable context-version metadata and upgrade eligibility.
31
+
32
+ Derived and transient state may reflect those sources, but they do not replace them as sources of truth.
33
+
34
+ ## Ownership Rules
35
+
36
+ - The human owns product direction, architectural guardrails, and approval for boundary expansion.
37
+ - Agents may refine durable documentation within existing boundaries.
38
+ - Agents must not create new persistent state categories or new state owners without updating architecture documents and obtaining human approval.
39
+
40
+ ## State Authority
41
+
42
+ - Authoritative state may be changed only through deliberate repository updates under the declared supervision model.
43
+ - Derived state may be regenerated, but must stay traceable to an authoritative source.
44
+ - Persistence responsibility must stay explicit whenever durable state is introduced or reorganized.
45
+
46
+ ## State Change Discipline
47
+
48
+ - Product documents establish meaning.
49
+ - Architecture documents establish ownership and authority.
50
+ - Environment and code documents may refine realization details without taking ownership away from architecture.
@@ -0,0 +1,38 @@
1
+ # Architecture Structure
2
+
3
+ - Path: `ctx/docs/architecture/structure.md`
4
+ - Changed: `20260707`
5
+
6
+ ## Purpose
7
+
8
+ Defines the major architectural blocks and responsibility boundaries of the skill product.
9
+
10
+ ## Architectural Blocks
11
+
12
+ - lifecycle orchestration surface — exposes the `init`, `design`, `validate`, `quality-audit`, `documentation-compression`, and `upgrade` capabilities as the main system behavior boundary;
13
+ - skill payload installation surface — copies the current `skill/` bundle into a caller-provided skills root as the `adsm-ctx` payload;
14
+ - `AGENTS.md` control surface — provides the service-control hierarchy used by agents during project work, while remaining subordinate to the declarative specifications in `ctx/docs/`;
15
+ - reusable template bundle — provides starter `ctx/` artifacts for downstream projects, including product and architecture documentation templates with only minimal ADSM bootstrap markers;
16
+ - documentation quality audit guidance boundary — provides the agent-facing audit prompt and working report template for evaluating documentation corpora without adding CLI-based semantic scoring;
17
+ - documentation compression guidance boundary — provides the agent-facing rewrite prompt and working report template for reducing `ctx/docs/` corpus size without changing accepted project meaning;
18
+ - `ctx/agent/` boundary definition — provides only the reserved branch boundary file for project-local materials that sit outside ADSM methodology;
19
+ - repository self-documentation — keeps the skill product governed by its own cognitive context;
20
+ - migration and validation boundary — checks structural conformance and applies safe convention upgrades;
21
+ - specialization routing boundary — identifies when project-specific skills must take over narrower documentation branches.
22
+
23
+ ## Responsibility Boundaries
24
+
25
+ - Product documentation defines the meaning and scope of the skill.
26
+ - Architecture defines stable engineering areas and their contracts.
27
+ - `AGENTS.md` files carry operational control inside those declared boundaries but do not define the boundaries on their own.
28
+ - Environment defines runtime prerequisites.
29
+ - Code defines implementation of the declared structure.
30
+
31
+ ## Structural Exclusions
32
+
33
+ This document does not list:
34
+
35
+ - source files or directories as architecture blocks;
36
+ - classes, functions, or modules;
37
+ - database tables or DTOs;
38
+ - endpoint-level API details.
@@ -0,0 +1,71 @@
1
+ # Architecture Supervision
2
+
3
+ - Path: `ctx/docs/architecture/supervision.md`
4
+ - Changed: `20260813`
5
+
6
+ ## Purpose
7
+
8
+ Defines how one human and many agents supervise architecture-level consistency.
9
+
10
+ ## Human-Agent Supervision Principle
11
+
12
+ Humans own architectural direction and guardrails.
13
+
14
+ Agents operate within documented architectural boundaries and perform the default operating work.
15
+
16
+ Architecture documentation is the authoritative medium through which the human direction-setting loop and the agent refinement and execution-support loop coordinate at the architecture level.
17
+
18
+ Agents must surface architectural drift instead of silently resolving it.
19
+
20
+ Major architectural boundary changes require human approval.
21
+
22
+ ## Human Responsibilities
23
+
24
+ - own architectural direction and guardrails;
25
+ - read semantic skins and relevant control documents frequently enough to detect drift early;
26
+ - approve new boundaries, persistent state, and integrations;
27
+ - resolve contradictions that architecture cannot settle from existing product knowledge.
28
+
29
+ ## Agent Responsibilities
30
+
31
+ - refine architecture documents within existing boundaries;
32
+ - prefer documentation updates before code when new architectural concepts appear;
33
+ - detect and report architectural drift;
34
+ - audit documentation corpora against declared ADSM documentation quality criteria when requested;
35
+ - compress documentation corpora only when accepted meaning, authority homes, and scope boundaries are clear;
36
+ - keep template-level workflow guidance separate from project-level workflow meaning;
37
+ - check product and architecture documents before code-oriented work.
38
+
39
+ ## Mandatory Approval Cases
40
+
41
+ Human approval is required for:
42
+
43
+ - new architectural owners;
44
+ - new persistent state;
45
+ - new external integrations;
46
+ - new trust boundaries;
47
+ - new major system areas;
48
+ - changes that resolve documentation quality findings by adding product meaning, architecture boundaries, or authority rules absent from existing context.
49
+ - compression changes that require choosing between contradictory meanings or deleting unclear project-specific knowledge.
50
+
51
+ ## Drift Signals
52
+
53
+ Architectural drift is present when:
54
+
55
+ - implementation introduces concepts absent from product or architecture documentation;
56
+ - architecture contradicts product roles, use cases, or domain entities;
57
+ - template-level workflow guidance is applied as if it overruled project-defined workflow semantics;
58
+ - documentation quality audit findings identify unresolved contradiction, missing upstream meaning, or duplicated authority across context documents;
59
+ - documentation compression removes, weakens, or generalizes accepted project-specific meaning;
60
+ - an agent document contradicts its matching semantic skin;
61
+ - new durable state appears without declared ownership;
62
+ - new integrations or boundaries appear only in code or environment artifacts.
63
+
64
+ ## Pre-Code Check Order
65
+
66
+ Before code-oriented work, agents should check:
67
+
68
+ 1. `ctx/docs/product/overview.md` and related product documents for meaning and scope;
69
+ 2. matching `*.skin.<lang>.md` files where they exist;
70
+ 3. `ctx/docs/architecture/*.md` and nested architecture documents for structure, behavior, state, integrations, constraints, decisions, and supervision;
71
+ 4. downstream environment and code documents for realization rules.
@@ -0,0 +1,51 @@
1
+ # Code Documentation
2
+
3
+ - Path: `ctx/docs/code/AGENTS.md`
4
+ - Changed: `20260708`
5
+
6
+ ## Purpose
7
+
8
+ Defines the code documentation level.
9
+
10
+ Documents at this level translate architecture intent into source-level engineering invariants: what counts as product code, how architecture is expressed in implementation, and how code is tested.
11
+
12
+ ## Level Map
13
+
14
+ - `AGENTS.md` — level definition for `ctx/docs/code/`.
15
+ - `overview.md` — product code boundary, code responsibilities, and code invariants.
16
+ - `testing.md` — test boundary, required coverage areas, and testing conventions.
17
+
18
+ ## Level Boundary
19
+
20
+ Defines:
21
+
22
+ - Product code boundary — what files and directories constitute executable or consumable product artifacts.
23
+ - Code invariants — rules that govern how architecture is expressed in implementation.
24
+ - Testing conventions — test structure, coverage expectations, and verification scope.
25
+
26
+ Does NOT define:
27
+
28
+ - Product meaning, domain entities, or use-case outcomes.
29
+ - Architecture ownership, system boundaries, or integration contracts.
30
+ - Deployment topology, runtime environment, or operational runbooks.
31
+
32
+ ## Relationship To Upstream Levels
33
+
34
+ Code depends on architecture and environment documentation.
35
+
36
+ The dependency order is:
37
+
38
+ ```text
39
+ product
40
+ → architecture
41
+ → environment
42
+ → code
43
+ ```
44
+
45
+ Code may refine realization details but must not redefine architecture structure, introduce new persistent state, create new external integrations, or bypass documented constraints.
46
+
47
+ Code invariants must remain consistent with architecture decisions and environment assumptions.
48
+
49
+ ## Local Rules
50
+
51
+ - Preserve nested code subdirectories when they improve maintainability.
@@ -0,0 +1,53 @@
1
+ # Code Overview
2
+
3
+ - Path: `ctx/docs/code/overview.md`
4
+ - Changed: `20260715`
5
+
6
+ ## Purpose
7
+
8
+ Defines what counts as product code in this repository.
9
+
10
+ ## Product Code Boundary
11
+
12
+ Product code includes both executable JavaScript and agent-consumed documentation artifacts.
13
+
14
+ Product code includes:
15
+
16
+ - `bin/` as the CLI entry points;
17
+ - `src/` as lifecycle implementation modules;
18
+ - `skill/SKILL.md` as the operational skill artifact;
19
+ - `skill/references/` as supporting guidance consumed by agents;
20
+ - `skill/templates/ctx/` as reusable initialization assets;
21
+ - `skill/templates/work/` as working templates for agent-produced operational outputs.
22
+
23
+ ## Code Responsibilities
24
+
25
+ - `bin/` exposes the CLI entry surface only.
26
+ - `src/` implements CLI-backed lifecycle behavior, filesystem operations, deterministic documentation lint for `ctx/docs/**`, and upgrade logic.
27
+ - `skill/` defines the installable agent payload that must be copied as a coherent bundle.
28
+
29
+ ## Service Control Files
30
+
31
+ `AGENTS.md` files are service control files consumed by agents during project work.
32
+
33
+ They are not the originating specification for their own format or hierarchy.
34
+
35
+ Local directory rules are described in the corresponding `AGENTS.md` file for each directory.
36
+
37
+ The skill and code consume and operationalize those local routing instructions directly from the applicable `AGENTS.md` hierarchy.
38
+
39
+ For this product, implementation-level handling of `AGENTS.md` must preserve these rules:
40
+
41
+ - `AGENTS.md` files are interpreted as operational instructions within already-declared product and architecture boundaries;
42
+ - hierarchy resolution is derived from repository structure and upstream documentation rules, not invented ad hoc by the skill;
43
+ - when a context-side `AGENTS.md` uses `Level Boundary`, that section is shaped as a compact guardrail rather than an exhaustive specification;
44
+ - validation logic may check `AGENTS.md` structure and placement, but must treat `ctx/docs` as the authoritative source of those requirements.
45
+ - validation logic may apply deterministic checks to semantic skins, but it must not impose a rigid template on ordinary agent documents.
46
+
47
+ ## Code Invariants
48
+
49
+ - `install-skill` installs the current contents of `skill/` into the target skills root as one payload.
50
+ - Repository self-context under `ctx/` and reusable starter context under `skill/templates/ctx/` are separate artifacts and must not be treated as interchangeable.
51
+ - Lifecycle commands must prefer declared context and template state over inferred project-specific assumptions.
52
+ - Deterministic validation may reject structural documentation defects, including undocumented documentation-level capacity exceptions, and assess semantic skins from the content of `Purpose`, `Mental Model`, `Scope`, and `Invariants` only: warn above 160 Unicode-aware words or 10 meaningful list items, and fail above 220 words or 14 items. Semantic document quality remains outside CLI validation.
53
+ - Code changes that expand durable state, external integrations, or architectural boundaries require prior documentation updates.
@@ -0,0 +1,26 @@
1
+ # Testing Overview
2
+
3
+ - Path: `ctx/docs/code/testing.md`
4
+ - Changed: `20260715`
5
+
6
+ ## Purpose
7
+
8
+ Defines the test boundary for this repository.
9
+
10
+ ## Test Boundary
11
+
12
+ - `test/unit/` contains targeted isolated coverage for selected modules and helpers; it does not yet mirror `src/`.
13
+ - `test/integration/` verifies composed runtime behavior through CLI scenarios and observable lifecycle invariants.
14
+
15
+ ## Current Coverage
16
+
17
+ - Unit coverage currently exists for bootstrap-level behavior.
18
+ - Unit coverage now also exercises deterministic validation logic for document metadata, agent/skin pairs, skin structure checks, `Scope` block checks, local markdown link checks, Unicode-aware semantic skin compactness thresholds, and documentation-level capacity exceptions.
19
+ - Integration coverage currently exercises end-to-end CLI behavior for `init`, `validate`, and `install-skill`.
20
+ - Installation-oriented tests verify observable installed payload structure rather than only internal helper calls.
21
+
22
+ ## Coverage Intent
23
+
24
+ - Unit tests should cover lifecycle services, shared helpers, CLI parsing, and skill-installation wiring in isolation.
25
+ - Validation tests should distinguish blocking structural errors from non-blocking heuristic warnings.
26
+ - Tests that exercise `AGENTS.md` handling should verify that validation and initialization follow requirements declared in `ctx/docs` rather than treating `AGENTS.md` as the source of its own specification.
@@ -0,0 +1,50 @@
1
+ # Environment Documentation
2
+
3
+ - Path: `ctx/docs/environment/AGENTS.md`
4
+ - Changed: `20260708`
5
+
6
+ ## Purpose
7
+
8
+ Defines the environment documentation level.
9
+
10
+ Documents at this level describe the runtime environment, infrastructural prerequisites, and operational assumptions required for system operation.
11
+
12
+ ## Level Map
13
+
14
+ - `AGENTS.md` — level definition for `ctx/docs/environment/`.
15
+ - `overview.md` — runtime assumptions, execution surfaces, external prerequisites, and operational constraints.
16
+
17
+ ## Level Boundary
18
+
19
+ Defines:
20
+
21
+ - Runtime environment assumptions — language runtime, filesystem model, and execution surfaces.
22
+ - External prerequisites — required tooling, minimum versions, and expected infrastructure.
23
+ - Operational constraints — conditions under which the system must remain valid regardless of deployment context.
24
+
25
+ Does NOT define:
26
+
27
+ - Product meaning, domain entities, or use-case outcomes.
28
+ - Architecture structure, system boundaries, or state ownership.
29
+ - Source-level implementation details, testing conventions, or code invariants.
30
+
31
+ ## Relationship To Upstream Levels
32
+
33
+ Environment depends on architecture documentation and feeds into code.
34
+
35
+ The dependency order is:
36
+
37
+ ```text
38
+ product
39
+ → architecture
40
+ → environment
41
+ → code
42
+ ```
43
+
44
+ Environment may add operational precision and constraints but must not redefine architecture structure or introduce new product capabilities.
45
+
46
+ Code-level documents must respect environment assumptions as non-negotiable prerequisites.
47
+
48
+ ## Local Rules
49
+
50
+ - Preserve nested environment subdirectories when they improve maintainability.
@@ -0,0 +1,33 @@
1
+ # Environment Overview
2
+
3
+ - Path: `ctx/docs/environment/overview.md`
4
+ - Changed: `20260702`
5
+
6
+ ## Purpose
7
+
8
+ Defines the runtime environment assumptions for this repository.
9
+
10
+ ## Runtime Assumptions
11
+
12
+ - Node.js executes the CLI, lifecycle logic, and automated tests.
13
+ - The package operates on local filesystem paths in the current repository or in explicitly provided target directories.
14
+ - The package must not depend on hardcoded absolute paths at runtime.
15
+
16
+ ## Execution Surfaces
17
+
18
+ - local CLI execution runs through `node` and the installed `adsm-ctx` entry point;
19
+ - package installation provides the CLI and bundled `skill/` payload to the host machine;
20
+ - agent-skill installation copies the packaged skill payload into the inter-agent skills root under `~/.agents/skills`;
21
+ - repository automation runs against a checked-out repository and uses the repository-local `ctx/` as its context source.
22
+
23
+ ## External Prerequisites
24
+
25
+ - Node.js `>=20` is required by the package contract.
26
+ - npm is the expected package-installation surface for local development and global installation.
27
+ - The repository is expected to be available as a writable working tree when lifecycle commands or workflow automation modify files.
28
+
29
+ ## Operational Environment Constraints
30
+
31
+ - Runtime behavior must remain valid whether the repository is executed from a developer checkout or from a globally installed package.
32
+ - Installation and validation flows must work with relative target paths supplied by the caller.
33
+ - Automation assumptions that depend on concrete tools, events, labels, or trusted actors belong to project-local materials under `ctx/agent/` rather than to the ADSM baseline.
@@ -0,0 +1,44 @@
1
+ # Filesystem Structure
2
+
3
+ - Path: `ctx/docs/filesystem.md`
4
+ - Changed: `20260707`
5
+
6
+ ## Purpose
7
+
8
+ Defines the declarative structure of the skill repository at the top level only and establishes repository boundaries as a navigation model.
9
+
10
+ ## Root Structure
11
+
12
+ - `.github/` — GitHub automation definitions, including the workflow that publishes `github-flows` application configuration.
13
+ - `bin/` — executable entry points for local lifecycle tooling.
14
+ - `ctx/` — cognitive context containing declarative documentation for this repository itself.
15
+ - `migrations/` — future migration definitions for context upgrades.
16
+ - `skill/` — installable skill payload consumed by agents.
17
+ - `src/` — implementation logic for CLI-backed lifecycle operations and shared helpers.
18
+ - `test/` — executable tests for CLI and lifecycle behavior.
19
+
20
+ ## Root Files
21
+
22
+ - `.gitignore` — version-control exclusion rules.
23
+ - `AGENTS.md` — root-level ADSM invariants.
24
+ - `jsconfig.json` — JavaScript language-service configuration.
25
+ - `LICENSE` — license definition.
26
+ - `README.md` — public human-facing documentation for the package.
27
+ - `package-lock.json` — npm dependency lockfile.
28
+ - `package.json` — package metadata, scripts, and CLI registration.
29
+ - `types.d.ts` — project-local type declarations.
30
+
31
+ ## Scope Rule
32
+
33
+ This document describes only top-level directories and root-level files.
34
+
35
+ Subdirectory structure, including anything inside `ctx/`, must be described in the corresponding lower-level documentation and service-control files when needed.
36
+
37
+ `AGENTS.md` files may describe local operational boundaries, but the normative rules for their structure belong to the declarative documentation under `ctx/docs/`.
38
+
39
+ ## Product Boundary
40
+
41
+ - `skill/` and `src/` are product artifacts of this repository.
42
+ - `skill/templates/ctx/` is the reusable template baseline installed into other projects.
43
+ - `skill/templates/work/` contains working templates for agent operations and is not installed into project `ctx/` by default.
44
+ - `ctx/` documents this repository as a skill product.