Skip to content

Commit 04d6e49

Browse files
committed
Enrich all 610 doc.go files to meet quality floor
Rewrites every doc.go in the project to meet the quality floor established in decision 2026-04-14: behavior-grounded content, 25-100 body lines, no lazy template patterns. Changes: - 493 stub doc.go files enriched with behavior descriptions, design rationale, and algorithm details - Removed Related Packages sections from all 610 files (drift liability outweighs benefit given IDE and GitNexus tooling) - Eliminated all lazy template patterns (Key exports, See source files, Part of subsystem) - Fixed compliance test issues: gofmt formatting, literal .md in config/file/doc.go, subcommand drift in cli-level doc.go - Copilot CLI skills and context assets synced via make build Signed-off-by: Jose Alekhinne <jose@ctx.ist> Spec: specs/docgo-quality-floor.md
1 parent af0439d commit 04d6e49

646 files changed

Lines changed: 17478 additions & 4522 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.context/AGENT_PLAYBOOK.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,54 @@ making a decision, learning something, or hitting a milestone:
1515
persist before continuing. Don't wait for session end; it may
1616
never come cleanly.
1717

18+
## Spec Requirement
19+
20+
Do not begin implementation work without a spec.
21+
22+
- Every implementation task must trace to a spec file
23+
- **If no spec exists, STOP and create one first**
24+
- Do not treat task text alone as a substitute for a spec
25+
26+
## Independent Review
27+
28+
Sub-agent review is not optional once implementation begins.
29+
30+
A review must be invoked when ANY of the following occur:
31+
32+
- Before the first modification to the codebase
33+
- After completing one or more tasks in TASKS.md
34+
- Before declaring the work complete
35+
36+
Required review inputs:
37+
- the governing spec
38+
- TASKS.md
39+
- the current implementation
40+
41+
Review prompt:
42+
- "Review <spec-file>, TASKS.md, and the current implementation for drift,
43+
omissions, invalid assumptions, and incomplete requirements."
44+
45+
Do not declare work complete until review findings are either resolved or
46+
explicitly recorded.
47+
48+
## File Interaction Protocol
49+
50+
When a task involves reading, modifying, or reasoning about a file:
51+
52+
1. **Read before act**
53+
- Read the file content directly before making any change
54+
- Do not rely on memory, summaries, or prior reads
55+
2. **No partial reads**
56+
- Do not sample the beginning or end of a file and assume the rest
57+
3. **Freshness requirement**
58+
- A read must be recent relative to the action
59+
- Do not reuse stale context from earlier in the session
60+
4. **No implicit scope**
61+
- "This change is small" is not a valid justification
62+
- "This file is large" is not a valid justification
63+
5. **Edit authority comes from visibility**
64+
- If you haven't seen it, you don't get to modify it
65+
1866
## Invoking ctx
1967

2068
Always use `ctx` from PATH:

.context/AGENT_PLAYBOOK_GATE.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,25 @@ lifecycle details, or anti-patterns.
1010
ctx status # correct
1111
./dist/ctx # wrong — never hardcode paths
1212
go run ./cmd/ctx # wrong — unless developing ctx itself
13-
```
13+
````
14+
15+
## File Interaction Protocol
16+
17+
When a task involves reading, modifying, or reasoning about a file:
18+
19+
1. **Read before act**: Do not rely on memory, summaries, or prior reads
20+
2. **No partial reads**: Do not sample and assume the rest
21+
3. **Freshness requirement**: Do not reuse stale context from earlier in the
22+
session
23+
4. **Edit authority comes from visibility**: If you haven't seen it, you don't
24+
get to modify it
25+
5. **Coverage requirement**: Before editing, state what parts of the file were
26+
read and why they are sufficient
1427

1528
## Planning Work
1629

30+
Do not begin implementation without a spec.
31+
1732
Every commit requires a `Spec:` trailer. Every piece of work needs
1833
a spec — no exceptions. Scale the spec to the work. Use `/ctx-spec`
1934
to scaffold.
@@ -28,16 +43,25 @@ persist before continuing. Don't wait for session end.
2843
For multi-step work: commit after each chunk, persist learnings,
2944
run tests before moving on. Track progress via TASKS.md checkboxes.
3045
46+
## Independent Review
47+
48+
A review must occur:
49+
50+
* Before the first code change
51+
* After completing tasks
52+
* Before presenting results
53+
54+
Review must consider:
55+
56+
* Spec
57+
* TASKS.md
58+
* Current implementation
59+
3160
## Tool Preferences
3261
3362
Use the `gemini-search` MCP server for web searches. Fall back to
3463
built-in search only if `gemini-search` is not connected.
3564
36-
## Check Available Skills
37-
38-
Before starting any task, scan available skills to see if one
39-
already handles the request. Prefer skills over ad-hoc work.
40-
4165
## Conversational Triggers
4266
4367
| User Says | Action |

.context/CONSTITUTION.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ If you start something, you own it, you finish it.
3030

3131
---
3232

33+
## Context Integrity Invariants
34+
35+
- [ ] **Never** modify or reason about a file based on partial or assumed content
36+
- [ ] If a file is the subject of an operation, its relevant contents must be
37+
**fully understood** before acting
38+
- [ ] Sampling, guessing, or relying on prior assumptions instead of
39+
reading is a **violation**
40+
41+
---
42+
3343
## No Excuse Generation
3444

3545
**Never default to deferral.**

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dist/
4646
.claude/settings.local.json
4747
.claude/ralph-loop.local.md
4848
.claude/scheduled_tasks.lock
49+
.claude/worktrees/
4950

5051
# Hook diagnostic logs (machine-specific, not committed)
5152
.context/logs/

cmd/ctx/doc.go

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,29 @@
66

77
// Package main is the entry point for the ctx CLI.
88
//
9-
// The binary delegates immediately to [bootstrap.Execute], which
10-
// builds the root cobra.Command, registers all 24 subcommand
11-
// packages, and calls cmd.Execute. No business logic lives here;
12-
// version injection happens via ldflags at build time.
9+
// The binary performs three steps at startup:
10+
//
11+
// 1. Initializes the embedded asset lookup table via
12+
// [lookup.Init] so that YAML-backed descriptions,
13+
// templates, and text constants are available to
14+
// every subcommand.
15+
// 2. Builds the root cobra.Command through
16+
// [bootstrap.Initialize], which registers all
17+
// subcommand packages, wires persistent flags,
18+
// and injects build-time version metadata via
19+
// ldflags.
20+
// 3. Calls cmd.Execute and translates any returned
21+
// error into a formatted stderr message via
22+
// [writeErr.With] before exiting with code 1.
23+
//
24+
// No business logic lives in this package. All
25+
// domain behavior is delegated to packages under
26+
// internal/.
27+
//
28+
// # Build-Time Injection
29+
//
30+
// Version, commit hash, and build date are injected
31+
// via ldflags at compile time. The Makefile and
32+
// goreleaser config set these values; the bootstrap
33+
// package reads them.
1334
package main

internal/assets/context/AGENT_PLAYBOOK.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,54 @@ making a decision, learning something, or hitting a milestone:
1515
persist before continuing. Don't wait for session end; it may
1616
never come cleanly.
1717

18+
## File Interaction Protocol
19+
20+
When a task involves reading, modifying, or reasoning about a file:
21+
22+
1. **Read before act**
23+
- Read the file content directly before making any change
24+
- Do not rely on memory, summaries, or prior reads
25+
2. **No partial reads**
26+
- Do not sample the beginning or end of a file and assume the rest
27+
3. **Freshness requirement**
28+
- A read must be recent relative to the action
29+
- Do not reuse stale context from earlier in the session
30+
4. **No implicit scope**
31+
- "This change is small" is not a valid justification
32+
- "This file is large" is not a valid justification
33+
5. **Edit authority comes from visibility**
34+
- If you haven't seen it, you don't get to modify it
35+
36+
## Spec Requirement
37+
38+
Do not begin implementation work without a spec.
39+
40+
- Every implementation task must trace to a spec file
41+
- **If no spec exists, STOP and create one first**
42+
- Do not treat task text alone as a substitute for a spec
43+
44+
## Independent Review
45+
46+
Sub-agent review is not optional once implementation begins.
47+
48+
A review must be invoked when ANY of the following occur:
49+
50+
- Before the first modification to the codebase
51+
- After completing one or more tasks in TASKS.md
52+
- Before declaring the work complete
53+
54+
Required review inputs:
55+
- the governing spec
56+
- TASKS.md
57+
- the current implementation
58+
59+
Review prompt:
60+
- "Review <spec-file>, TASKS.md, and the current implementation for drift,
61+
omissions, invalid assumptions, and incomplete requirements."
62+
63+
Do not declare work complete until review findings are either resolved or
64+
explicitly recorded.
65+
1866
## Invoking ctx
1967

2068
Always use `ctx` from PATH:
@@ -24,7 +72,6 @@ ctx agent # ✓ correct
2472
./dist/ctx # ✗ avoid hardcoded paths
2573
go run ./cmd/ctx # ✗ avoid unless developing ctx itself
2674
```
27-
2875
Check with `which ctx` if unsure whether it's installed.
2976

3077
## Context Readback

internal/assets/context/AGENT_PLAYBOOK_GATE.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,25 @@ lifecycle details, or anti-patterns.
1010
ctx status # correct
1111
./dist/ctx # wrong — never hardcode paths
1212
go run ./cmd/ctx # wrong — unless developing ctx itself
13-
```
13+
````
14+
15+
## File Interaction Protocol
16+
17+
When a task involves reading, modifying, or reasoning about a file:
18+
19+
1. **Read before act**: Do not rely on memory, summaries, or prior reads
20+
2. **No partial reads**: Do not sample and assume the rest
21+
3. **Freshness requirement**: Do not reuse stale context from earlier in the
22+
session
23+
4. **Edit authority comes from visibility**: If you haven't seen it, you don't
24+
get to modify it
25+
5. **Coverage requirement**: Before editing, state what parts of the file were
26+
read and why they are sufficient
1427

1528
## Planning Work
1629

30+
Do not begin implementation without a spec.
31+
1732
Every commit requires a `Spec:` trailer. Every piece of work needs
1833
a spec — no exceptions. Scale the spec to the work. Use `/ctx-spec`
1934
to scaffold.
@@ -28,6 +43,20 @@ persist before continuing. Don't wait for session end.
2843
For multi-step work: commit after each chunk, persist learnings,
2944
run tests before moving on. Track progress via TASKS.md checkboxes.
3045
46+
## Independent Review
47+
48+
A review must occur:
49+
50+
* Before the first code change
51+
* After completing tasks
52+
* Before presenting results
53+
54+
Review must consider:
55+
56+
* Spec
57+
* TASKS.md
58+
* Current implementation
59+
3160
## Tool Preferences
3261
3362
Use the `gemini-search` MCP server for web searches. Fall back to

internal/assets/context/CONSTITUTION.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ If you start something, you own it, you finish it.
3232

3333
---
3434

35+
## Context Integrity Invariants
36+
37+
- [ ] **Never** modify or reason about a file based on partial or assumed content
38+
- [ ] If a file is the subject of an operation, its relevant contents must be
39+
**fully understood** before acting
40+
- [ ] Sampling, guessing, or relying on prior assumptions instead of reading
41+
is a **violation**
42+
43+
---
44+
3545
## No Excuse Generation
3646

3747
**Never default to deferral.**

internal/assets/doc.go

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,45 @@
44
// \ Copyright 2026-present Context contributors.
55
// SPDX-License-Identifier: Apache-2.0
66

7-
// Package assets provides the embedded filesystem for ctx.
7+
// Package assets provides the embedded filesystem for
8+
// ctx.
89
//
9-
// All templates, skills, hooks, YAML text files, and the Claude
10-
// Code plugin manifest are compiled into the binary via go:embed.
11-
// The single exported variable [FS] is the entry point for all
12-
// embedded asset reads. Subdirectories under assets/read/ provide
13-
// typed accessors grouped by domain (desc, entry, hook, skill, etc.).
10+
// All templates, skills, hooks, YAML text files, and
11+
// the Claude Code plugin manifest are compiled into
12+
// the binary via go:embed. The single exported
13+
// variable FS is the entry point for all embedded
14+
// asset reads.
15+
//
16+
// # Embedded Content
17+
//
18+
// The FS variable includes:
19+
//
20+
// - claude/ -- CLAUDE.md, plugin.json, and skill
21+
// definitions with SKILL.md and reference docs
22+
// - context/ -- context file templates (TASKS.md,
23+
// DECISIONS.md, CONVENTIONS.md, etc.)
24+
// - entry-templates/ -- Markdown scaffolds for new
25+
// decisions, learnings, tasks, conventions
26+
// - hooks/ -- message templates and trace scripts
27+
// for lifecycle hooks
28+
// - integrations/ -- Copilot instructions, CLI
29+
// hooks, agent configs, and scripts
30+
// - project/ -- README templates for subdirectories
31+
// - schema/ -- JSON Schema for .ctxrc validation
32+
// - why/ -- philosophy documents (manifesto, about,
33+
// design invariants)
34+
// - permissions/ -- permission text files
35+
// - commands/ -- YAML command/flag descriptions
36+
//
37+
// # Accessor Packages
38+
//
39+
// Subdirectories under assets/read/ provide typed
40+
// accessors grouped by domain, so callers do not
41+
// need to know embed paths:
42+
//
43+
// - read/desc -- command/flag/text descriptions
44+
// - read/entry -- entry template files
45+
// - read/hook -- hook message templates
46+
// - read/skill -- skill SKILL.md files
47+
// - read/template -- context file templates
1448
package assets

0 commit comments

Comments
 (0)