From 7bfba11c312a6004081bed6a59335a5c0c1aadff Mon Sep 17 00:00:00 2001 From: John Sell Date: Thu, 30 Apr 2026 15:12:04 -0400 Subject: [PATCH 01/16] refactor: move design specs to specs/{domain}/ Move *.spec.md files from docs/internal/design/ into capability domain directories under specs/: sessions/, control-plane/, integrations/, agents/. Update all cross-references in devflow skill, guide files, and within the moved specs themselves. Historical metrics data in scripts/coderabbit-triage/ intentionally left unchanged. Part of #1478 Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/skills/devflow/SKILL.md | 12 ++++++------ docs/internal/design/ambient-model.guide.md | 6 +++--- docs/internal/design/mcp-server.guide.md | 6 +++--- .../internal/design => specs/agents}/runner.spec.md | 2 +- .../control-plane}/control-plane.spec.md | 2 +- .../design => specs/integrations}/mcp-server.spec.md | 2 +- .../design => specs/sessions}/ambient-model.spec.md | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) rename {docs/internal/design => specs/agents}/runner.spec.md (99%) rename {docs/internal/design => specs/control-plane}/control-plane.spec.md (99%) rename {docs/internal/design => specs/integrations}/mcp-server.spec.md (99%) rename {docs/internal/design => specs/sessions}/ambient-model.spec.md (99%) diff --git a/.claude/skills/devflow/SKILL.md b/.claude/skills/devflow/SKILL.md index bef64acde..b9af7c34f 100644 --- a/.claude/skills/devflow/SKILL.md +++ b/.claude/skills/devflow/SKILL.md @@ -78,7 +78,7 @@ Every component has a spec file. Load the spec for the component being changed: | Component | Spec | Guide | |-----------|------|-------| -| Data Model / API / CLI / RBAC | `docs/internal/design/ambient-model.spec.md` | `docs/internal/design/ambient-model.guide.md` | +| Data Model / API / CLI / RBAC | `specs/sessions/ambient-model.spec.md` | `workflows/sessions/ambient-model.workflow.md` | ### 2b. Modify the Spec @@ -87,7 +87,7 @@ Edit the spec to reflect the desired change. The spec is the source of truth — ### 2c. Commit Spec Change ```bash -git add docs/internal/design/ +git add specs/ git commit -m "spec(): " ``` @@ -111,7 +111,7 @@ After spec acceptance (or in parallel for human workflow), load the implementati | Component | Guide | Context | |-----------|-------|---------| -| Data Model / API | `docs/internal/design/ambient-model.guide.md` | `.claude/context/api-server-development.md` | +| Data Model / API | `workflows/sessions/ambient-model.workflow.md` | `.claude/context/api-server-development.md` | | SDK | (guide section in ambient-model.guide.md Wave 3) | `.claude/context/sdk-development.md` | | CLI | (guide section Wave 5) | `.claude/context/cli-development.md` | | Control Plane | (guide section Wave 4) | `.claude/context/control-plane-development.md` | @@ -134,7 +134,7 @@ Commits are ordered deliberately: 1. **Self-improvement commit (first).** Any changes to guides, skills, workflows, or this devflow skill. Group all such changes into one commit: ```bash - git add .claude/skills/ .claude/context/ docs/internal/design/*.guide.md + git add skills/ workflows/ git commit -m "chore(skills): self-improvement updates from " ``` - Agentic workflow: this is the first commit on the branch. @@ -354,8 +354,8 @@ But prefer fixing the lint/format issue instead. | `.claude/context/sdk-development.md` | SDK generation | | `.claude/context/control-plane-development.md` | CP fan-out, runner contract | | `.claude/context/frontend-development.md` | Frontend build, React Query | -| `docs/internal/design/ambient-model.spec.md` | Data model spec (source of truth) | -| `docs/internal/design/ambient-model.guide.md` | Implementation guide (wave-based workflow) | +| `specs/sessions/ambient-model.spec.md` | Data model spec (source of truth) | +| `workflows/sessions/ambient-model.workflow.md` | Implementation workflow (wave-based) | --- diff --git a/docs/internal/design/ambient-model.guide.md b/docs/internal/design/ambient-model.guide.md index b4036e50d..7af854715 100755 --- a/docs/internal/design/ambient-model.guide.md +++ b/docs/internal/design/ambient-model.guide.md @@ -64,7 +64,7 @@ Checklist: ### Step 2 — Read the Spec -Read `docs/internal/design/ambient-model.spec.md` in full. +Read `specs/sessions/ambient-model.spec.md` in full. Extract and hold in working memory: @@ -453,8 +453,8 @@ The old Gin/K8s backend (`components/backend/`) is covered by `.claude/context/b | Artifact | Location | Owner | | --------------------- | ---------------------------------------------------- | ----------------- | -| Spec | `docs/internal/design/ambient-model.spec.md` | Human / consensus | -| This guide | `docs/internal/design/ambient-model.guide.md` | Updated each run | +| Spec | `specs/sessions/ambient-model.spec.md` | Human / consensus | +| This workflow | `workflows/sessions/ambient-model.workflow.md` | Updated each run | | OpenAPI spec | `components/ambient-api-server/openapi/openapi.yaml` | API wave | | Generated SDK | `components/ambient-sdk/go-sdk/` | SDK wave | | Wave PRs | GitHub, tagged by wave and component | Per wave | diff --git a/docs/internal/design/mcp-server.guide.md b/docs/internal/design/mcp-server.guide.md index 501293d35..7806b48a8 100644 --- a/docs/internal/design/mcp-server.guide.md +++ b/docs/internal/design/mcp-server.guide.md @@ -255,7 +255,7 @@ Checklist: ### Step 2 — Read the Full Tool Spec -Read `docs/internal/design/mcp-server.spec.md` in full for the complete per-tool input schemas, return shapes, and error tables. +Read `specs/integrations/mcp-server.spec.md` in full for the complete per-tool input schemas, return shapes, and error tables. Read `docs/internal/proposals/agent-fleet-state-schema.md` for the annotation key conventions that all `patch_*_annotations` tools must honor. @@ -458,8 +458,8 @@ Lessons learned: ## References -- Full per-tool schemas, return shapes, and error tables: `docs/internal/design/mcp-server.spec.md` +- Full per-tool schemas, return shapes, and error tables: `specs/integrations/mcp-server.spec.md` - Annotation key conventions and fleet state protocol: `docs/internal/proposals/agent-fleet-state-schema.md` - Agent visual language (how purple SEND/WAIT blocks map to MCP tools): `docs/internal/proposals/agent-script-visual-language.md` - Platform data model: `docs/internal/design/ambient-data-model.md` -- Component pipeline and wave pattern: `docs/internal/design/ambient-model.guide.md` +- Component pipeline and wave pattern: `workflows/sessions/ambient-model.workflow.md` diff --git a/docs/internal/design/runner.spec.md b/specs/agents/runner.spec.md similarity index 99% rename from docs/internal/design/runner.spec.md rename to specs/agents/runner.spec.md index 385e3ab74..f35099455 100644 --- a/docs/internal/design/runner.spec.md +++ b/specs/agents/runner.spec.md @@ -2,7 +2,7 @@ **Date:** 2026-04-05 **Status:** Living Document — current state documented -**Related:** `control-plane.spec.md` — CP provisioning, token endpoint, start context assembly +**Related:** `../control-plane/control-plane.spec.md` — CP provisioning, token endpoint, start context assembly --- diff --git a/docs/internal/design/control-plane.spec.md b/specs/control-plane/control-plane.spec.md similarity index 99% rename from docs/internal/design/control-plane.spec.md rename to specs/control-plane/control-plane.spec.md index b4ab61058..753fc8cb1 100755 --- a/docs/internal/design/control-plane.spec.md +++ b/specs/control-plane/control-plane.spec.md @@ -2,7 +2,7 @@ **Date:** 2026-03-22 **Status:** Living Document — current state documented; proposed changes marked -**Guide:** `control-plane.guide.md` — implementation waves, gap table, build commands +**Workflow:** `../../workflows/control-plane/control-plane.workflow.md` — implementation waves, gap table, build commands --- diff --git a/docs/internal/design/mcp-server.spec.md b/specs/integrations/mcp-server.spec.md similarity index 99% rename from docs/internal/design/mcp-server.spec.md rename to specs/integrations/mcp-server.spec.md index 8645fae3a..47b7d53be 100644 --- a/docs/internal/design/mcp-server.spec.md +++ b/specs/integrations/mcp-server.spec.md @@ -2,7 +2,7 @@ **Date:** 2026-03-22 **Status:** Design -**Guide:** `mcp-server.guide.md` — implementation waves, gap table, build commands, run log +**Workflow:** `../../workflows/integrations/mcp-server.workflow.md` — implementation waves, gap table, build commands, run log --- diff --git a/docs/internal/design/ambient-model.spec.md b/specs/sessions/ambient-model.spec.md similarity index 99% rename from docs/internal/design/ambient-model.spec.md rename to specs/sessions/ambient-model.spec.md index f1054ea68..b17f6a003 100755 --- a/docs/internal/design/ambient-model.spec.md +++ b/specs/sessions/ambient-model.spec.md @@ -3,7 +3,7 @@ **Date:** 2026-03-20 **Status:** Proposed — Pending Consensus **Last Updated:** 2026-04-28 — added `ScheduledSession` Kind; added session operational sub-resources (workspace, files, git, repos, tasks, runner protocol); added generic proxy surface for backend passthrough; updated coverage matrix: all ScheduledSession commands implemented; session sub-resources (workspace/files/git/repos/operational/runner protocol) implemented in API server; generic proxy plugin implemented -**Guide:** `ambient-model.guide.md` — implementation waves, gap table, build commands, run log +**Workflow:** `../../workflows/sessions/ambient-model.workflow.md` — implementation waves, gap table, build commands, run log **Design:** `credentials-session.md` — full Credential Kind design spec and rationale --- From 6e01be8ba5dccea2932058c94473ae8194848603 Mon Sep 17 00:00:00 2001 From: John Sell Date: Thu, 30 Apr 2026 15:14:39 -0400 Subject: [PATCH 02/16] refactor: move standards to specs/standards/{domain}/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move conventions, patterns, and standards files into domain-organized directories under specs/standards/: - backend/ — conventions, error handling, K8s client patterns - frontend/ — conventions, React Query patterns - control-plane/ — operator conventions - security/ — security standards - platform/ — cross-cutting conventions (CodeRabbit-derived) Update all references in agent definitions, amber-review skill, CLAUDE.md, and BOOKMARKS.md. Part of #1478 Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/agents/backend-review.md | 6 +++--- .claude/agents/convention-eval.md | 14 +++++++------- .claude/agents/frontend-review.md | 4 ++-- .claude/agents/operator-review.md | 6 +++--- .claude/agents/security-review.md | 2 +- .claude/skills/amber-review/SKILL.md | 14 +++++++------- BOOKMARKS.md | 16 ++++++++-------- CLAUDE.md | 8 ++++---- docs/pr-1307-impact-analysis.md | 2 +- .../standards/backend/conventions.spec.md | 0 .../standards/backend/error-handling.spec.md | 0 .../standards/backend/k8s-client.spec.md | 0 .../standards/control-plane/conventions.spec.md | 0 .../standards/frontend/conventions.spec.md | 0 .../standards/frontend/react-query.spec.md | 0 .../standards/platform/cross-cutting.spec.md | 0 .../standards/security/security.spec.md | 0 17 files changed, 36 insertions(+), 36 deletions(-) rename components/backend/DEVELOPMENT.md => specs/standards/backend/conventions.spec.md (100%) rename components/backend/ERROR_PATTERNS.md => specs/standards/backend/error-handling.spec.md (100%) rename components/backend/K8S_CLIENT_PATTERNS.md => specs/standards/backend/k8s-client.spec.md (100%) rename components/operator/DEVELOPMENT.md => specs/standards/control-plane/conventions.spec.md (100%) rename components/frontend/DEVELOPMENT.md => specs/standards/frontend/conventions.spec.md (100%) rename components/frontend/REACT_QUERY_PATTERNS.md => specs/standards/frontend/react-query.spec.md (100%) rename docs/coderabbit-derived-conventions.md => specs/standards/platform/cross-cutting.spec.md (100%) rename docs/security-standards.md => specs/standards/security/security.spec.md (100%) diff --git a/.claude/agents/backend-review.md b/.claude/agents/backend-review.md index e52475c91..d77d8c101 100644 --- a/.claude/agents/backend-review.md +++ b/.claude/agents/backend-review.md @@ -19,9 +19,9 @@ Review backend Go code against documented conventions. Load these files before running checks: -1. `components/backend/DEVELOPMENT.md` -2. `components/backend/ERROR_PATTERNS.md` -3. `components/backend/K8S_CLIENT_PATTERNS.md` +1. `specs/standards/backend/conventions.spec.md` +2. `specs/standards/backend/error-handling.spec.md` +3. `specs/standards/backend/k8s-client.spec.md` ## Checks diff --git a/.claude/agents/convention-eval.md b/.claude/agents/convention-eval.md index 77c1af78d..8a4573b21 100644 --- a/.claude/agents/convention-eval.md +++ b/.claude/agents/convention-eval.md @@ -18,13 +18,13 @@ Evaluate codebase adherence to documented conventions. Produce a scored report. Load these before running checks: -1. `components/backend/DEVELOPMENT.md` -2. `components/backend/ERROR_PATTERNS.md` -3. `components/backend/K8S_CLIENT_PATTERNS.md` -4. `components/frontend/DEVELOPMENT.md` -5. `components/frontend/REACT_QUERY_PATTERNS.md` -6. `components/operator/DEVELOPMENT.md` -7. `docs/security-standards.md` +1. `specs/standards/backend/conventions.spec.md` +2. `specs/standards/backend/error-handling.spec.md` +3. `specs/standards/backend/k8s-client.spec.md` +4. `specs/standards/frontend/conventions.spec.md` +5. `specs/standards/frontend/react-query.spec.md` +6. `specs/standards/control-plane/conventions.spec.md` +7. `specs/standards/security/security.spec.md` ## Checks by Category diff --git a/.claude/agents/frontend-review.md b/.claude/agents/frontend-review.md index 988ff504f..b1b275e9a 100644 --- a/.claude/agents/frontend-review.md +++ b/.claude/agents/frontend-review.md @@ -19,8 +19,8 @@ Review frontend code against documented conventions. Load these files before running checks: -1. `components/frontend/DEVELOPMENT.md` -2. `components/frontend/REACT_QUERY_PATTERNS.md` +1. `specs/standards/frontend/conventions.spec.md` +2. `specs/standards/frontend/react-query.spec.md` 3. `components/frontend/DESIGN_GUIDELINES.md` (if it exists) ## Checks diff --git a/.claude/agents/operator-review.md b/.claude/agents/operator-review.md index cbad8e4ec..4ae2e4a45 100644 --- a/.claude/agents/operator-review.md +++ b/.claude/agents/operator-review.md @@ -19,9 +19,9 @@ Review operator Go code against documented conventions. Load these files before running checks: -1. `components/operator/DEVELOPMENT.md` -2. `components/backend/K8S_CLIENT_PATTERNS.md` -3. `components/backend/ERROR_PATTERNS.md` +1. `specs/standards/control-plane/conventions.spec.md` +2. `specs/standards/backend/k8s-client.spec.md` +3. `specs/standards/backend/error-handling.spec.md` ## Checks diff --git a/.claude/agents/security-review.md b/.claude/agents/security-review.md index 4f5f3b64f..2c72b5139 100644 --- a/.claude/agents/security-review.md +++ b/.claude/agents/security-review.md @@ -19,7 +19,7 @@ Cross-cutting security review against documented security standards. Load these files before running checks: -1. `docs/security-standards.md` +1. `specs/standards/security/security.spec.md` ## Checks diff --git a/.claude/skills/amber-review/SKILL.md b/.claude/skills/amber-review/SKILL.md index fc7882740..cb5223e31 100644 --- a/.claude/skills/amber-review/SKILL.md +++ b/.claude/skills/amber-review/SKILL.md @@ -26,13 +26,13 @@ Consider the user input before proceeding (if not empty). The input may specify Read all of the following files to build your review context. Do not skip any. 1. `CLAUDE.md` (master project instructions) -2. `components/backend/DEVELOPMENT.md` (Go backend, Gin, K8s integration) -3. `components/frontend/DEVELOPMENT.md` (NextJS, Shadcn UI, React Query) -4. `docs/security-standards.md` (auth, RBAC, token handling, container security) -5. `components/backend/K8S_CLIENT_PATTERNS.md` (user token vs service account) -6. `components/backend/ERROR_PATTERNS.md` (consistent error patterns) -7. `components/frontend/REACT_QUERY_PATTERNS.md` (data fetching patterns) -8. `components/operator/DEVELOPMENT.md` (K8s operator, reconciliation, OwnerReferences) +2. `specs/standards/backend/conventions.spec.md` (Go backend, Gin, K8s integration) +3. `specs/standards/frontend/conventions.spec.md` (NextJS, Shadcn UI, React Query) +4. `specs/standards/security/security.spec.md` (auth, RBAC, token handling, container security) +5. `specs/standards/backend/k8s-client.spec.md` (user token vs service account) +6. `specs/standards/backend/error-handling.spec.md` (consistent error patterns) +7. `specs/standards/frontend/react-query.spec.md` (data fetching patterns) +8. `specs/standards/control-plane/conventions.spec.md` (K8s operator, reconciliation, OwnerReferences) ### 2. Identify Changes to Review diff --git a/BOOKMARKS.md b/BOOKMARKS.md index ed91ee466..b5156ce70 100644 --- a/BOOKMARKS.md +++ b/BOOKMARKS.md @@ -43,7 +43,7 @@ Progressive disclosure for task-specific documentation and references. | Document | Purpose | |----------|---------| -| [CodeRabbit-Derived Conventions](docs/coderabbit-derived-conventions.md) | Image consistency, reconciliation patterns, error propagation, namespace-scoped keys, SecurityContext — derived from 971 CodeRabbit review comments | +| [CodeRabbit-Derived Conventions](specs/standards/platform/cross-cutting.spec.md) | Image consistency, reconciliation patterns, error propagation, namespace-scoped keys, SecurityContext — derived from 971 CodeRabbit review comments | ## Component Development Guides @@ -51,13 +51,13 @@ Convention documentation for each component. Loaded by review agents on demand. | Guide | Scope | |-------|-------| -| [Backend Development](components/backend/DEVELOPMENT.md) | Go patterns, K8s integration, handler conventions, user-scoped clients | -| [Backend Error Patterns](components/backend/ERROR_PATTERNS.md) | Consistent error patterns across backend and operator | -| [Backend K8s Client Patterns](components/backend/K8S_CLIENT_PATTERNS.md) | User token vs. service account — critical for RBAC compliance | -| [Frontend Development](components/frontend/DEVELOPMENT.md) | NextJS patterns, Shadcn, React Query, component guidelines | -| [Frontend React Query Patterns](components/frontend/REACT_QUERY_PATTERNS.md) | Data fetching hooks, mutations, cache invalidation | -| [Operator Development](components/operator/DEVELOPMENT.md) | OwnerReferences, reconciliation patterns, SecurityContext, resource limits | -| [Security Standards](docs/security-standards.md) | Auth flows, RBAC, token handling, container security | +| [Backend Conventions](specs/standards/backend/conventions.spec.md) | Go patterns, K8s integration, handler conventions, user-scoped clients | +| [Backend Error Handling](specs/standards/backend/error-handling.spec.md) | Consistent error patterns across backend and operator | +| [Backend K8s Client](specs/standards/backend/k8s-client.spec.md) | User token vs. service account — critical for RBAC compliance | +| [Frontend Conventions](specs/standards/frontend/conventions.spec.md) | NextJS patterns, Shadcn, React Query, component guidelines | +| [Frontend React Query](specs/standards/frontend/react-query.spec.md) | Data fetching hooks, mutations, cache invalidation | +| [Operator Conventions](specs/standards/control-plane/conventions.spec.md) | OwnerReferences, reconciliation patterns, SecurityContext, resource limits | +| [Security Standards](specs/standards/security/security.spec.md) | Auth flows, RBAC, token handling, container security | ## Component Guides diff --git a/CLAUDE.md b/CLAUDE.md index d1672f5f1..120570576 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -123,10 +123,10 @@ component DEVELOPMENT.md files (see [BOOKMARKS.md](BOOKMARKS.md) > Component Dev - **Restricted SecurityContext on all containers**: `runAsNonRoot`, drop `ALL` capabilities, `readOnlyRootFilesystem` Component-specific conventions: -- Backend: [DEVELOPMENT.md](components/backend/DEVELOPMENT.md), [ERROR_PATTERNS.md](components/backend/ERROR_PATTERNS.md), [K8S_CLIENT_PATTERNS.md](components/backend/K8S_CLIENT_PATTERNS.md) -- Frontend: [DEVELOPMENT.md](components/frontend/DEVELOPMENT.md), [REACT_QUERY_PATTERNS.md](components/frontend/REACT_QUERY_PATTERNS.md) -- Operator: [DEVELOPMENT.md](components/operator/DEVELOPMENT.md) -- Security: [security-standards.md](docs/security-standards.md) +- Backend: [conventions](specs/standards/backend/conventions.spec.md), [error handling](specs/standards/backend/error-handling.spec.md), [K8s client](specs/standards/backend/k8s-client.spec.md) +- Frontend: [conventions](specs/standards/frontend/conventions.spec.md), [React Query](specs/standards/frontend/react-query.spec.md) +- Operator: [conventions](specs/standards/control-plane/conventions.spec.md) +- Security: [security standards](specs/standards/security/security.spec.md) ## Pre-commit Hooks diff --git a/docs/pr-1307-impact-analysis.md b/docs/pr-1307-impact-analysis.md index 79388f59d..8b41856e6 100644 --- a/docs/pr-1307-impact-analysis.md +++ b/docs/pr-1307-impact-analysis.md @@ -12,7 +12,7 @@ This document demonstrates the impact of PR #1307 (Claude Code automation overha | **backend/ERROR_PATTERNS.md** | HTTP status code conventions (404 vs 400 vs 502) | After the signature fix, `ConnectCodeRabbit` now returns 502 on network errors vs 400 on invalid keys — a distinction this doc requires. | | **frontend/DEVELOPMENT.md** | Zero-tolerance rules (no `any`, Shadcn only, React Query for all data) | Connection card uses only `Card`, `Button`, `Input`, `Label` from `@/components/ui/*`. API client is pure functions in `services/api/`, hooks in `services/queries/`. No manual `fetch()` in components. | | **frontend/REACT_QUERY_PATTERNS.md** | Query/mutation hook structure, cache invalidation | `useConnectCodeRabbit` and `useDisconnectCodeRabbit` invalidate both `['coderabbit', 'status']` and `['integrations', 'status']` on success — the dual-invalidation pattern from this doc. | -| **docs/security-standards.md** | Token handling, RBAC enforcement, input validation | API keys never logged (only `len(token)` pattern initially, then simplified). `validateCodeRabbitAPIKeyImpl` uses `networkError()` to strip URLs from error messages — preventing credential leakage. | +| **specs/standards/security/security.spec.md** | Token handling, RBAC enforcement, input validation | API keys never logged (only `len(token)` pattern initially, then simplified). `validateCodeRabbitAPIKeyImpl` uses `networkError()` to strip URLs from error messages — preventing credential leakage. | | **settings.json hooks** | Real-time enforcement during edits (Shadcn reminder, React Query reminder, K8s client reminder, no-panic reminder) | These hooks fired during subagent implementation, keeping each subagent on-pattern even without full codebase context. The Shadcn hook ensures no raw `