Commit Graph

20 Commits

Author SHA1 Message Date
Paul O'Reilly
c8691368e4 distill: flush prior-session best-practice additions
Additive/refining entries left uncommitted in the working tree from an earlier
distill session (found during the 2026-07 sweep commit): agent-repos 5-step
plan pattern; ai-parallel-agents cheap-model scope; spec-driven spec-inversion
and caller/callee cross-reference rules.
2026-07-02 15:58:52 +12:00
Paul O'Reilly
7e348f5ee3 distill: 48 cross-project best-practices from 2026-07 reflection sweep
Promotions from reflecting 21 projects' session logs (incl. agent-runtimes
122-log drain). Adds coverage across networking (eBPF VIP/VPN SNAT/VLAN
bridge/forward-auth preflight/ingress TLS), kubernetes (CSI hotplug/PodSecurity
debug/self-managed GitOps/runtime annotations), CI (dispatch tokens/runner
death/base image), git (CI-rebase/shallow reset/PR governance), python (async
session pool/httpx redirects/logging), TDD (AsyncMock/xfail lifecycle),
api-integration (SDK parse/token-scope 404/schema probing), plus docker,
scripting, debugging, security-architecture, secrets, react, octopus.

State: .distill-state.json refreshed with current HEADs + 5 newly-tracked projects.
2026-07-02 15:57:42 +12:00
Paul O'Reilly
5e67cbcfbb feat: add React + Vite dashboard best practices topic
Cross-project reference covering React 19, Vite, Tailwind v4,
shadcn/ui, TanStack Query/Table, react-hook-form + Zod, OIDC auth,
Vitest + Testing Library + MSW, and 16 other dashboard patterns.
2026-07-02 14:48:40 +12:00
Paul O'Reilly
bd3a99e2ad docs(airouter): correct failure-path picture + F70 vs local divergence
The previous "Dogfood Failure Path: Branch + Logs Lost" section was wrong
on two counts (verified by M16 Wave B3, 2026-05-08):

1. The agent's branch IS pushed on F70-failure (dispatcher logs "branch
   will still push (partial work preserved)"). The earlier "no branch"
   claim was a fetch-refspec mistake — both B2 and B3 have task-<id>
   branches on the agents fork.

2. The CP task record's logs ARE populated (~50 KB on B3). What's actually
   missing is the pytest stdout/stderr from the F70 invocation — only the
   high-level "Tests failed" line is logged.

Section retitled "What's Visible, What Isn't" with the corrected picture.
Operator pattern updated: fetch the task branch, apply the diff locally,
run the test — if local passes, cherry-pick to main.

New section "F70 Pytest Can Disagree with Local Pytest" captures the B3
finding: airouter's 15-line MN-14 validator passed 5/5 locally but F70
reported failure twice. Possible causes listed; workaround is
--max-test-iterations 1 + local apply-and-run after failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 20:27:41 +12:00
Paul O'Reilly
52cd0a3cb6 docs(airouter): 2026-05-08 dogfood batch + test design rules
Three additions to agent-repos.md based on the post-A1-incident dogfood
batch (8 successes + 1 operator-induced "failure"):

1. Airouter Qwen3.6 section: pattern reconfirmed across M16 Wave A1/A2/B1
   and M25 Waves A1-A5 + B1-B2. Time-to-success bands recorded for cost
   calibration (1m30s for git rm; ~5 min for Pydantic regex; ~12 min for
   class addition). Default --max-test-iterations 1 for cheap probes.

2. New section: Test Design for AI Agent Dogfood Pipelines. Triggered by
   the M16 Wave B2 (MN-4 prompt cap) failure — a 14-minute airouter run
   blamed on the agent that was actually an over-strict test asserting on
   sanitised 422 body content. CP's RequestValidationError handler strips
   Pydantic detail for security; tests asserting body content for that
   path are structurally impossible. Rules: verify test passes against a
   reference impl before pushing; status-code-only ceiling for validator-
   driven 422s; model on previous successes not stricter variants; F70
   retries don't recover structurally impossible tests.

3. New section: Dogfood Failure Path: Branch + Logs Lost. When all F70
   retries exhaust, the agent's last attempt is not pushed to the agents
   fork, the CP task record's logs field is empty, and the pod is gone.
   Operator must reproduce locally — until F70 finalize-on-failure pushes
   the failed branch.

BESTPRACTICES.md index updated to reflect the new sub-topics.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 19:50:45 +12:00
Paul O'Reilly
7bfabceaac docs(airouter): confirm single-file-unit pattern with D4a+D4b results
D4a (harness.yaml, 1 file) = success
D4b (CLAUDE.md, 1 file) = success
Both succeeded where original D4 (2 files) = silent no-output.

Pattern confirmed: single-file scope is the reliable unit for airouter/Qwen3.6.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 15:52:55 +12:00
Paul O'Reilly
e618ca4d22 docs(airouter): add scope-decomposition guidance for Qwen3.6 reliability
Airouter Qwen3.6 reliable for single-file tasks; unreliable for multi-file/multi-rule.
D7 (single harness + one rule) = success. D4 (two files, multiple rules) = silent no-output.

Pattern: decompose airouter tasks to one file per dispatch.
BUG-21 reference included.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 15:06:43 +12:00
Paul O'Reilly
b1aa40b043 kubernetes: SSA via CustomObjectsApi needs apply-patch+yaml client
Document the kubernetes-py v35 gotcha that bit M22 Phase 8: patch with
force=True against the default merge-patch Content-Type returns 422
silently in mocks but breaks at the apiserver. Workaround is a
dedicated ApiClient with the apply-patch header.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 14:08:23 +12:00
Paul O'Reilly
8aa04f256c kubernetes.md: Cilium entities apply beyond monitoring; ipBlock no-op for nodes
Reframe "Cilium Entity Identities for Monitoring Scraping" as
cross-cutting -- the same entity table applies to any pod that
needs to reach cluster infrastructure (apiserver, kubelets,
node-exporter, host services), not just Prometheus.

Add the gotcha that bit M22 Phase 7: standard NetworkPolicy
ipBlock CIDR rules do NOT match cluster node IPs. Nodes carry
the Cilium remote-node/kube-apiserver identity and ipBlock only
matches off-cluster IPs. The misleading symptom is a 30s hang
followed by a generic upstream error like "permission denied"
(seen on OpenBao TokenReview, would also affect ESO+vault k8s
auth, and any controller calling subjectaccessreviews).

Same gotcha applies to namespaceSelector: kube-system -- the
apiserver runs hostNetwork=true and is not selectable that way.

Source incident: agent-runtimes M22 Phase 7 F-OPENBAO-K8S-AUTH-1
(homelab/openbao-deploy@f7bd64d).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 14:41:15 +12:00
Paul O'Reilly
47d616996c feat: add mechanical-test-generation best practice
Eight practices for writing specs that serve as direct input to
automated test-generation agents, extracted from the M15 Mechanical
Process Nodes milestone review: module layout tables, integration
boundary marking, explicit library semantics, concrete interfaces over
"implementation detail", error messages as test data, pattern tables as
parametric matrices, scenario selection, and pre-dispatch testability
assessment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 13:19:43 +12:00
Paul O'Reilly
6154031cf9 api-design: add API-first methodology, DX, and contract testing
Extends api-design.md beyond its security/operations focus with three
new dimensions:

- §0 API-First Design Process — OpenAPI 3.1 as single source of truth,
  Spectral governance, dogfooding (UIs consume the public API, no
  privileged backdoors), auth-required-by-default as a design stance.
- §7 Documentation and Developer Experience — Scalar/Mintlify,
  RFC 9457 Problem Details error envelope, interactive playgrounds,
  generated SDKs (Stainless, Speakeasy, Fern), RFC 9745 deprecation
  signals and changelog UX.
- §8 Contract Testing and API Quality — schema validation in the
  test suite, Pact CDC vs provider verification, Schemathesis
  property-based fuzzing, oasdiff drift detection in CI, the API
  test pyramid.

Intro, cross-refs in §3.1/§3.3/§4.1, and Sources block reorganised
by topic. Index entry in BESTPRACTICES.md updated. PLAN file included
for traceability.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 13:42:03 +12:00
Paul O'Reilly
22d49b2c9a distill: best practices from 2026-04-19 cross-project run
Adds 3 new topic files (ai-parallel-agents, api-integration,
python-patterns) and extends 21 existing topic files with new gotchas
and patterns surfaced from memory across tracked projects. Index
updated accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 13:41:47 +12:00
Paul O'Reilly
8aa400a5d4 distill: 49 best practices from 5 projects (2026-03-27..2026-04-05)
Add 37 new entries and update 7 existing entries across 13 topic files.
Major contributions from agent-runtimes (K8s secrets, CI, Docker gotchas),
cluster-bootstrap (ArgoCD SSA, etcd tuning, DB migrations, Compose networking),
and cluster-apps/octopus-deploy (Helm vs raw manifests, ArgoCD source types).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 01:10:07 +12:00
Paul O'Reilly
423bd155f9 tdd: add read-only test gates and model selection for AI agents
Learnings from F58 3-way model comparison (Sonnet/MiniMax/Haiku):
- Read-only test gates: filesystem enforcement (chmod a-w) because
  prompt instructions are insufficient — MiniMax edited tests 7x,
  Haiku rewrote entirely, only Sonnet respected constraints
- Model selection table: Sonnet minimum for constrained implementation,
  Haiku/MiniMax viable for review and test-writing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 21:49:02 +12:00
Paul O'Reilly
25ecb8c69e add CI container build best practices
Registry cache with inline metadata, buildx docker driver for DinD,
dependency layer separation (stub package pattern for setuptools),
pip cache retention, scheduled base image builds. Includes measured
results from Gitea Actions with DinD runners.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 12:28:22 +12:00
Paul O'Reilly
bff46b9182 Add agent repos & container agent operations best practice
Comprehensive guide covering task submission to the agent-runtimes
control plane, available harnesses, monitoring, multi-model workflows,
agent repo forks with workspace layout, and artifact extraction patterns.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 11:32:48 +12:00
Paul O'Reilly
4fa12d5db8 Add API design and LLM code security best practices
Two new topic files from research:
- api-design.md: Transport security, OAuth2/JWT/mTLS auth, API patterns
  (versioning, pagination, idempotency, rate limiting), input validation,
  secrets handling, zero-trust service mesh patterns. Maps to OWASP API
  Security Top 10.
- llm-code-security.md: Common vulnerabilities in LLM-generated code
  (injection, hardcoded secrets, hallucinated packages, over-permissive
  defaults, IaC risks, crypto mistakes). Includes per-technology review
  checklists and cites 18 research sources (2024-2026).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 10:58:52 +13:00
Paul O'Reilly
ef8bda3bb4 Add distill state tracking file
Migrated from claude-foundations. Tracks per-project git SHAs for
incremental distillation runs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:49:10 +13:00
Paul O'Reilly
3efe153ca1 Populate best practices from claude-foundations
Migrates 20 topic files from claude-foundations/best-practices/ to this
standalone repo. Adds BESTPRACTICES.md index, CLAUDE.md conventions, and
updated README.md. Container agents clone this repo to /best-practices.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:46:13 +13:00
1ca7ecfe19 Initial commit 2026-03-28 04:45:07 +00:00