code-anchored-context 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/code-anchored-context/SKILL.md +5 -5
- package/AGENTS.md +12 -11
- package/README.md +7 -7
- package/bin/code-anchored-context.js +11 -10
- package/context/AGENTS.md +2 -2
- package/context/README.md +5 -9
- package/context/_templates/initiative/README.md +2 -2
- package/context/_templates/initiative/release-doc-notes.md +5 -6
- package/context/_templates/planned-initiative/README.md +1 -1
- package/context/_templates/planned-initiative/release-doc-notes.md +4 -5
- package/context/terminology.md +2 -2
- package/package.json +5 -9
- package/product-docs/README.md +61 -0
- package/{docs → product-docs}/_authoring/README.md +6 -6
- package/{docs → product-docs}/_authoring/areas/README.md +2 -2
- package/{docs → product-docs}/_authoring/areas/_template.md +5 -5
- package/{docs → product-docs}/_authoring/terminology.md +1 -1
- package/{docs → product-docs}/_authoring/workflow.md +36 -35
- package/{docs → product-docs}/releases/index.md +2 -2
- package/context/code-anchored-context-structure.md +0 -133
- package/context/code-anchored-context-why.md +0 -80
- package/context/code-anchored-context.html +0 -830
- package/context/giving-ai-agents-context-around-code.md +0 -496
- package/docs/.order +0 -2
- package/docs/Welcome.md +0 -48
- /package/{docs → product-docs}/_templates/area/README.md +0 -0
- /package/{docs → product-docs}/_templates/area/features/feature-template.md +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Docs Workflow
|
|
1
|
+
# Product Docs Workflow
|
|
2
2
|
|
|
3
3
|
This file defines how documentation is versioned, refreshed, and structured
|
|
4
4
|
across the repo. It applies to all documented areas; area-specific guidance
|
|
5
5
|
lives in [`areas/`](areas/).
|
|
6
6
|
|
|
7
|
-
## When Docs Get Edited
|
|
7
|
+
## When Product Docs Get Edited
|
|
8
8
|
|
|
9
9
|
Doc refresh is an explicit, on-request activity, not a side effect of code
|
|
10
|
-
work. Humans or agents touch `docs/` only when:
|
|
10
|
+
work. Humans or agents touch `product-docs/` only when:
|
|
11
11
|
|
|
12
12
|
- A human explicitly asks for a release-time refresh, typically after the
|
|
13
13
|
release tag is cut and QA has signed off.
|
|
@@ -18,8 +18,8 @@ work. Humans or agents touch `docs/` only when:
|
|
|
18
18
|
- A human asks to fix a demonstrable error in an existing page, such as a
|
|
19
19
|
broken link or factual inaccuracy.
|
|
20
20
|
|
|
21
|
-
Do not update docs as part of a feature PR, bug fix, refactor, or
|
|
22
|
-
bump. Mid-stream commits are partial work; "feature complete" is only
|
|
21
|
+
Do not update product docs as part of a feature PR, bug fix, refactor, or
|
|
22
|
+
dependency bump. Mid-stream commits are partial work; "feature complete" is only
|
|
23
23
|
well-defined once the release is accepted.
|
|
24
24
|
|
|
25
25
|
Agents: if you are working on a code change and notice a doc that looks
|
|
@@ -27,11 +27,11 @@ outdated, leave it alone. Flag the staleness in your summary or add it to the
|
|
|
27
27
|
initiative's `release-doc-notes.md`, but do not edit the doc as part of the
|
|
28
28
|
current change unless explicitly asked.
|
|
29
29
|
|
|
30
|
-
## Docs Modes
|
|
30
|
+
## Product Docs Modes
|
|
31
31
|
|
|
32
|
-
There are two valid ways to introduce or maintain `docs/`.
|
|
32
|
+
There are two valid ways to introduce or maintain `product-docs/`.
|
|
33
33
|
|
|
34
|
-
### Baseline Docs
|
|
34
|
+
### Baseline Product Docs
|
|
35
35
|
|
|
36
36
|
Use this mode only when a human explicitly asks to document the current system
|
|
37
37
|
as a starting point. This is common when adopting the template in an existing
|
|
@@ -42,54 +42,55 @@ When creating a baseline:
|
|
|
42
42
|
1. Confirm the scope: whole repo, one product area, one feature family, or one
|
|
43
43
|
operational surface.
|
|
44
44
|
2. Create or update the matching area guide under
|
|
45
|
-
`docs/_authoring/areas/` before writing product-facing pages.
|
|
45
|
+
`product-docs/_authoring/areas/` before writing product-facing pages.
|
|
46
46
|
3. Document stable, currently accepted behavior from the current branch,
|
|
47
47
|
current tag, or explicit reference point named by the human.
|
|
48
48
|
4. Prefer broad, accurate coverage over exhaustive implementation detail.
|
|
49
|
-
5. Record the baseline reference in `docs/releases/index.md`. If
|
|
49
|
+
5. Record the baseline reference in `product-docs/releases/index.md`. If
|
|
50
50
|
there is no release tag yet, use the commit, branch, date, or human-named
|
|
51
51
|
baseline label that was used as the source.
|
|
52
|
-
6. Leave uncertain or future behavior out of `docs/`. Capture open
|
|
52
|
+
6. Leave uncertain or future behavior out of `product-docs/`. Capture open
|
|
53
53
|
questions in `context/` or in the area authoring guide.
|
|
54
54
|
|
|
55
|
-
Baseline docs are a snapshot of the system as adopted; they are not a
|
|
56
|
-
that every undocumented behavior is unimportant.
|
|
55
|
+
Baseline product docs are a snapshot of the system as adopted; they are not a
|
|
56
|
+
promise that every undocumented behavior is unimportant.
|
|
57
57
|
|
|
58
|
-
### Release-Forward Docs
|
|
58
|
+
### Release-Forward Product Docs
|
|
59
59
|
|
|
60
60
|
Use this mode when the team chooses not to create a full baseline. In this
|
|
61
|
-
mode, `docs/` may start sparse. Agents capture documentation impact
|
|
61
|
+
mode, `product-docs/` may start sparse. Agents capture documentation impact
|
|
62
62
|
in initiative `release-doc-notes.md` during development, then update product
|
|
63
|
-
docs only at explicit release-refresh time.
|
|
63
|
+
product docs only at explicit release-refresh time.
|
|
64
64
|
|
|
65
65
|
This is valid when a full baseline would be too expensive. The documentation
|
|
66
66
|
becomes complete incrementally around behavior the team changes and releases.
|
|
67
67
|
|
|
68
68
|
## Cadence And Versioning
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
refreshed once per release, at git-tag time, after release acceptance.
|
|
72
|
-
docs are anchored to the release tag;
|
|
73
|
-
describe the behavior of that release.
|
|
70
|
+
Product docs live under `product-docs/`. After any explicit baseline pass,
|
|
71
|
+
they are refreshed once per release, at git-tag time, after release acceptance.
|
|
72
|
+
Product docs are anchored to the release tag; product docs at tag
|
|
73
|
+
`release/v1_2_3` describe the behavior of that release.
|
|
74
74
|
|
|
75
75
|
Default tag names follow the convention `release/vMAJOR_MINOR_PATCH` and match
|
|
76
76
|
the release branch name. If a project uses a different release convention,
|
|
77
77
|
document it here before the first refresh. If the first documentation pass is
|
|
78
78
|
a baseline without a tag, record the baseline reference in
|
|
79
|
-
`docs/releases/index.md`.
|
|
79
|
+
`product-docs/releases/index.md`.
|
|
80
80
|
|
|
81
81
|
## Audience
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
owners, solution owners, support engineers, customer engineers, or
|
|
85
|
-
Adjust this only when the project explicitly defines a different
|
|
83
|
+
Product docs are written for non-developer technical readers by default: QA,
|
|
84
|
+
product owners, solution owners, support engineers, customer engineers, or
|
|
85
|
+
operators. Adjust this only when the project explicitly defines a different
|
|
86
|
+
audience.
|
|
86
87
|
|
|
87
88
|
- Describe behavior, inputs, outputs, permissions, error conditions, and
|
|
88
89
|
business rules in domain language.
|
|
89
90
|
- Avoid code snippets, private type names, SQL, and framework jargon unless
|
|
90
91
|
the concept has no plain-language equivalent.
|
|
91
|
-
- For readers who need more depth than the docs provide, link to the
|
|
92
|
-
rather than replicating the implementation in prose.
|
|
92
|
+
- For readers who need more depth than the product docs provide, link to the
|
|
93
|
+
source rather than replicating the implementation in prose.
|
|
93
94
|
|
|
94
95
|
## Writing Focus
|
|
95
96
|
|
|
@@ -100,10 +101,10 @@ or business process can observe. Add technical detail only when it affects
|
|
|
100
101
|
released behavior, configuration, permissions, data, integrations, errors,
|
|
101
102
|
support, operations, or auditability.
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
second. They can feed release notes, but they are more durable than release
|
|
105
|
-
release notes summarize what changed, while `docs/` describes
|
|
106
|
-
the accepted system does as of a release or baseline.
|
|
104
|
+
Product docs should be product-readable first and technically anchored
|
|
105
|
+
second. They can feed release notes, but they are more durable than release
|
|
106
|
+
notes: release notes summarize what changed, while `product-docs/` describes
|
|
107
|
+
what the accepted system does as of a release or baseline.
|
|
107
108
|
|
|
108
109
|
Use progressive depth:
|
|
109
110
|
|
|
@@ -127,7 +128,7 @@ Every documented area has two layers:
|
|
|
127
128
|
Standard per-area layout:
|
|
128
129
|
|
|
129
130
|
```text
|
|
130
|
-
docs/<Area>/
|
|
131
|
+
product-docs/<Area>/
|
|
131
132
|
README.md
|
|
132
133
|
features/
|
|
133
134
|
<feature>.md
|
|
@@ -169,18 +170,18 @@ user-facing or operator-facing entry point. Cross-link from the other areas.
|
|
|
169
170
|
|
|
170
171
|
## Release-Time Doc Refresh
|
|
171
172
|
|
|
172
|
-
When invoked to refresh docs for a release:
|
|
173
|
+
When invoked to refresh product docs for a release:
|
|
173
174
|
|
|
174
175
|
1. Work from the diff `<previous-release-tag>..HEAD`, scoped to one area at a
|
|
175
176
|
time.
|
|
176
|
-
2. Read the matching area guide in `docs/_authoring/areas/`.
|
|
177
|
+
2. Read the matching area guide in `product-docs/_authoring/areas/`.
|
|
177
178
|
3. Read relevant initiative `release-doc-notes.md` files under
|
|
178
179
|
`context/releases/<release>/initiatives/`.
|
|
179
180
|
4. Update the area's `README.md` if the high-level picture changed.
|
|
180
181
|
5. Update feature pages for behavior that changed.
|
|
181
182
|
6. Ignore pure refactors, internal renames, test-only changes, formatting,
|
|
182
183
|
lint fixes, and dependency bumps with no behavior change.
|
|
183
|
-
7. Append one row to `docs/releases/index.md`.
|
|
184
|
+
7. Append one row to `product-docs/releases/index.md`.
|
|
184
185
|
|
|
185
186
|
## Source Order
|
|
186
187
|
|
|
@@ -189,7 +190,7 @@ source inspection:
|
|
|
189
190
|
|
|
190
191
|
1. Previous release tag to current release diff.
|
|
191
192
|
2. Relevant initiative `release-doc-notes.md` files.
|
|
192
|
-
3. Matching area guide under `docs/_authoring/areas/`.
|
|
193
|
+
3. Matching area guide under `product-docs/_authoring/areas/`.
|
|
193
194
|
4. Existing product documentation.
|
|
194
195
|
5. Source code, tests, config, CI/CD, infrastructure, and generated artifacts
|
|
195
196
|
only as needed to verify shipped behavior.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Product Docs Release Index
|
|
2
2
|
|
|
3
3
|
One row per tagged release. Tag names default to `release/vMAJOR_MINOR_PATCH`
|
|
4
4
|
unless the project documents a different convention.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Product docs at a given tag describe the behavior of that release.
|
|
7
7
|
|
|
8
8
|
| Tag | Date | Areas refreshed | Owner | Summary |
|
|
9
9
|
| --- | --- | --- | --- | --- |
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
# Code-Anchored Context: The Structure
|
|
2
|
-
|
|
3
|
-
This is the companion to the
|
|
4
|
-
[reasoning article](code-anchored-context-why.md). It covers how working
|
|
5
|
-
context is laid out so both humans and agents can navigate it.
|
|
6
|
-
|
|
7
|
-
## Denormalize Navigation, Not Knowledge
|
|
8
|
-
|
|
9
|
-
Agents and IDEs do not always open from the repo root. They may start in
|
|
10
|
-
product code, CI/CD config, infrastructure code, generated artifacts, or a
|
|
11
|
-
nested app. If all guidance lives at the top, it gets missed. If each area
|
|
12
|
-
keeps its own plans, cross-project work fragments.
|
|
13
|
-
|
|
14
|
-
> Denormalize navigation, not knowledge.
|
|
15
|
-
|
|
16
|
-
Local `AGENTS.md` files point agents toward the right place. But plans, specs,
|
|
17
|
-
ADRs, release context, testing strategy, delivery notes, and infrastructure
|
|
18
|
-
context live centrally under `context/`.
|
|
19
|
-
|
|
20
|
-
## The Core Model
|
|
21
|
-
|
|
22
|
-
Vocabulary is captured in `context/terminology.md`. The main containers:
|
|
23
|
-
|
|
24
|
-
```text
|
|
25
|
-
Program Long-lived multi-release effort.
|
|
26
|
-
Planned initiative A scoped future slice inside a program.
|
|
27
|
-
Release initiative Active or historical work for a specific release.
|
|
28
|
-
Context backlog item Isolated work cut from scope but worth preserving.
|
|
29
|
-
Program release slice What a release contributes to a program.
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Each kind of context gets a home:
|
|
33
|
-
|
|
34
|
-
```text
|
|
35
|
-
context/
|
|
36
|
-
terminology.md
|
|
37
|
-
current.md
|
|
38
|
-
programs/
|
|
39
|
-
backlog/
|
|
40
|
-
releases/
|
|
41
|
-
_templates/
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Structure follows delivery concerns, not technologies. Name a file for the
|
|
45
|
-
knowledge it preserves, not the tool that produced it.
|
|
46
|
-
|
|
47
|
-
## Release Initiatives
|
|
48
|
-
|
|
49
|
-
The main unit of active delivery:
|
|
50
|
-
|
|
51
|
-
```text
|
|
52
|
-
context/releases/<version>/initiatives/<initiative>/
|
|
53
|
-
README.md plan.md spec.md interface.md architecture.md
|
|
54
|
-
testing.md delivery.md infrastructure.md operations.md
|
|
55
|
-
backlog.md decisions/ release-doc-notes.md
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
The most important file is `plan.md` — the working alignment space. It can be
|
|
59
|
-
messy with notes, options, and tradeoffs, with one rule:
|
|
60
|
-
|
|
61
|
-
> `plan.md` may be messy, but it must not be the only place settled truth lives.
|
|
62
|
-
|
|
63
|
-
Once something stabilizes, it moves to a durable file:
|
|
64
|
-
|
|
65
|
-
```text
|
|
66
|
-
spec.md What the system should do.
|
|
67
|
-
interface.md How clients, APIs, config, or tools interact with it.
|
|
68
|
-
architecture.md Internal shape, boundaries, data flow, tradeoffs.
|
|
69
|
-
testing.md Verification strategy, coverage, gates, known gaps.
|
|
70
|
-
delivery.md CI/CD, build, deployment, promotion, release toggles.
|
|
71
|
-
infrastructure.md Environments, IaC, networking, identity, storage, secrets.
|
|
72
|
-
operations.md Runtime/support: observability, failure modes, rollback.
|
|
73
|
-
backlog.md Trackable work items and progress.
|
|
74
|
-
decisions/ Durable decisions and consequences (ADRs).
|
|
75
|
-
release-doc-notes.md What should become product documentation later.
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Not every initiative needs every file. The point is to give stable knowledge a
|
|
79
|
-
place to land — testing, delivery, and infrastructure are first-class context,
|
|
80
|
-
not afterthoughts buried in pipeline files or PRs.
|
|
81
|
-
|
|
82
|
-
## Programs And Planned Initiatives
|
|
83
|
-
|
|
84
|
-
Some work is bigger than one release. A program holds durable multi-release
|
|
85
|
-
context:
|
|
86
|
-
|
|
87
|
-
```text
|
|
88
|
-
context/programs/<program>/
|
|
89
|
-
README.md context.md roadmap.md backlog.md
|
|
90
|
-
decisions/ planned-initiatives/ releases/
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Future work that is clear enough to plan — but whose target release is not
|
|
94
|
-
current yet — becomes a planned initiative:
|
|
95
|
-
|
|
96
|
-
```text
|
|
97
|
-
context/programs/<program>/planned-initiatives/<initiative>/
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
When the target release becomes current, it is promoted into
|
|
101
|
-
`context/releases/<version>/initiatives/<initiative>/`. Promotion is
|
|
102
|
-
explicit; the original planned initiative stays as historical context.
|
|
103
|
-
|
|
104
|
-
## Context Backlog
|
|
105
|
-
|
|
106
|
-
Work cut from scope but worth preserving — when it doesn't justify a program or
|
|
107
|
-
planned initiative — lives in:
|
|
108
|
-
|
|
109
|
-
```text
|
|
110
|
-
context/backlog/items/<originating-initiative>--<item>.md
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Each item records where it came from, why it was deferred, future value, and
|
|
114
|
-
re-entry criteria. If picked up later, it is marked promoted and linked — never
|
|
115
|
-
silently rewritten.
|
|
116
|
-
|
|
117
|
-
## Release Transitions
|
|
118
|
-
|
|
119
|
-
Changing the current release is more than editing a pointer. When
|
|
120
|
-
`context/current.md` moves to a new release, agents should scan program
|
|
121
|
-
planned initiatives, promote items targeting the new release into the release
|
|
122
|
-
folder, update links both ways, and preserve the originals as history.
|
|
123
|
-
|
|
124
|
-
```mermaid
|
|
125
|
-
flowchart TD
|
|
126
|
-
Start["Set a new current release"]
|
|
127
|
-
Scan["Scan program planned initiatives"]
|
|
128
|
-
Promote["Promote into releases/<version>/initiatives/"]
|
|
129
|
-
Link["Update links both ways"]
|
|
130
|
-
Preserve["Preserve original as history"]
|
|
131
|
-
|
|
132
|
-
Start --> Scan --> Promote --> Link --> Preserve
|
|
133
|
-
```
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Code-Anchored Context: Giving AI Agents The Context Around The Code
|
|
2
|
-
|
|
3
|
-
AI agents are good at reading repositories, editing files, and following
|
|
4
|
-
instructions. But in large codebases, code is not the whole story.
|
|
5
|
-
|
|
6
|
-
The hard part is not whether an agent can change a file. It is whether it
|
|
7
|
-
understands the intent behind the change, the current release scope, the
|
|
8
|
-
decisions already made, the work deliberately deferred, how the change should
|
|
9
|
-
be verified, how it ships, and what infrastructure or operational risks
|
|
10
|
-
surround it.
|
|
11
|
-
|
|
12
|
-
That context usually exists — in chats, tickets, pull request comments,
|
|
13
|
-
planning notes, and people's heads — but agents need it in a structured,
|
|
14
|
-
discoverable form.
|
|
15
|
-
|
|
16
|
-
## Docs vs Working Context
|
|
17
|
-
|
|
18
|
-
This is why I separate **released product documentation** from **working
|
|
19
|
-
context**:
|
|
20
|
-
|
|
21
|
-
```text
|
|
22
|
-
docs/ What shipped.
|
|
23
|
-
context/ What we are planning, building, deciding, testing,
|
|
24
|
-
shipping, hosting, deferring, and learning.
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Product documentation stays stable and release-accurate: it describes a known
|
|
28
|
-
release, not an unfinished branch. Working context is allowed to evolve —
|
|
29
|
-
it is where humans and agents work through ambiguity.
|
|
30
|
-
|
|
31
|
-
## The Principle
|
|
32
|
-
|
|
33
|
-
I think of this as **Code-Anchored Context**. Not a methodology — a rule of
|
|
34
|
-
thumb:
|
|
35
|
-
|
|
36
|
-
> Keep truth as close to code as possible, and keep the surrounding context
|
|
37
|
-
> structured enough that both humans and agents can find it.
|
|
38
|
-
|
|
39
|
-
It is opinionated on purpose: prefer repository-local context, explicit
|
|
40
|
-
lifetimes, and navigable structure over scattered notes that only make sense
|
|
41
|
-
to the people who were in the room. Repository-local context scales beyond one
|
|
42
|
-
person.
|
|
43
|
-
|
|
44
|
-
## Why It Travels
|
|
45
|
-
|
|
46
|
-
When context is materialized in the repository, it stops being tied to one
|
|
47
|
-
chat transcript, IDE, agent, or session. A team can switch tools without
|
|
48
|
-
losing the trail of why the system is shaped the way it is. The next human or
|
|
49
|
-
agent opens the repo and continues from the same accumulated understanding
|
|
50
|
-
instead of reconstructing it from memory.
|
|
51
|
-
|
|
52
|
-
```mermaid
|
|
53
|
-
flowchart LR
|
|
54
|
-
Code["Codebase<br/>What exists"]
|
|
55
|
-
Dev["context/<br/>What is being planned, built, decided, tested, shipped, deferred"]
|
|
56
|
-
Docs["docs/<br/>What shipped in a known release"]
|
|
57
|
-
Agents["Agents and humans"]
|
|
58
|
-
|
|
59
|
-
Agents --> Code
|
|
60
|
-
Agents --> Dev
|
|
61
|
-
Dev -->|"release-doc-notes.md captures future docs impact"| Docs
|
|
62
|
-
Docs -->|"stable release truth"| Agents
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Why It Matters
|
|
66
|
-
|
|
67
|
-
Code-Anchored Context is context continuity. It helps agents and humans answer:
|
|
68
|
-
|
|
69
|
-
- What is active now, and what belongs to a future phase?
|
|
70
|
-
- What was cut from scope, and why was a decision made?
|
|
71
|
-
- How should this be tested, and what gates must pass before release?
|
|
72
|
-
- How will it ship, and what infrastructure does it depend on?
|
|
73
|
-
- What should become product documentation later?
|
|
74
|
-
- What reasoning needs to survive a change of IDE, agent, or session?
|
|
75
|
-
|
|
76
|
-
Code tells an agent *what exists*. Working context tells it *why* it
|
|
77
|
-
exists, where it is going, what has been decided, and what was left for later.
|
|
78
|
-
|
|
79
|
-
For the concrete folder layout, see the companion article,
|
|
80
|
-
[Code-Anchored Context: The Structure](code-anchored-context-structure.md).
|