Skip to content

chore: rightsize agent context per Claude 5 context-engineering guidance - #155

Merged
George-RD merged 1 commit into
mainfrom
agent/rightsize-agent-context
Aug 7, 2026
Merged

chore: rightsize agent context per Claude 5 context-engineering guidance#155
George-RD merged 1 commit into
mainfrom
agent/rightsize-agent-context

Conversation

@George-RD

@George-RD George-RD commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Applies Anthropic's new rules of context engineering for Claude 5 generation models to this repo's agent setup.

Correctness fix (not just bloat)

.claude, .codex, and .opencode carried openspec 1.3.1 skills instructing:

mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>

That is the raw-move ceremony scripts/check-omp-ceremony.sh:31 forbids — but the check only guards .omp/. Archiving a change from any of those three harnesses left spec deltas unapplied in openspec/specs/. Six files also referenced openspec-sync-specs / opsx-continue, forbidden by name at check-omp-ceremony.sh:37-39.

Deleted. .omp/ (1.6.0-beta.1, hand-patched) is now the single maintained copy, and the CLI-archive rule was lifted into AGENTS.md so it survives regeneration in any harness.

The hand-written openspine-change-landing-ceremony skill is a symlink into ~/repos/agent-skills and is untouched.

Context changes

Change Rule from the post
AGENTS.md: 8 graphify-only lines → 67 gotcha-dense lines "spend most of the tokens on gotchas"
CLAUDE.md@AGENTS.md (was byte-identical) drift elimination
.ignore excludes generated graph data from agent search search surface
Dropped PreToolUse nag hooks "Now: simple tool descriptions"
Graphify reframed from mandate to judgement "Now: let Claude use judgement"

The dropped hooks re-injected the same "read GRAPH_REPORT.md" sentence as additionalContext on every Glob/Grep (.claude/settings.json) and every Bash (.codex/hooks.json) — a sentence already present in AGENTS.md. The graphify rule also pointed at graphify-out/wiki/index.md, which does not exist.

Gotchas now captured in AGENTS.md, each previously discoverable only by burning a full check.sh cycle:

  • kernel E2E spawns the real openspine-shell binary; bare cargo test --workspace fails
  • 500-line cap + // openspine:allow-large-module reason: escape, and the #[path = "<n>_tests.rs"] split habit (31 files use it)
  • capabilities/capability-map.json generates into two markdown files between markers
  • every test: row in docs/threat-claims.md must name a real test
  • canon (.raw/*-log.md) beats openspine-change-sequence.md on conflict

Search surface

2,528 of 3,451 tracked files (73%, 92MB) were graphify-out/cache/ content-addressed blobs walked by every glob and grep.

glob graphify-out/**/*.json:  2,580 → 3 files

.ignore is honoured only by ripgrep-family tools — git still tracks everything and the cache is intact, so the graphify pre-commit hook is unaffected (it regenerated the graph in this very commit).

Verification

check-omp-ceremony: generated OMP files carry the repo archive ceremony.
check-file-sizes:   all crates/**/*.rs files are within the 500-line limit.
capability-map:     source, evidence, and public roadmap are consistent.
capability-map.test.mjs: fail 0
openspec validate --all --strict: 46 passed, 0 failed

No .rs or Cargo.* touched, so fmt / clippy / cargo test cannot be affected. Every gate step that can respond to these changes ran and passed.

Note

Two stale facts corrected while grounding AGENTS.md: this repo runs cargo test --workspace, not nextest (no nextest string in scripts/, .github/, or Cargo.toml), and -y is not forbidden in repo text — the actual rule is --yes on openspec archive only.


Summary by cubic

Rightsizes the agent context to match Claude 5 guidance by moving critical repo gotchas into AGENTS.md, simplifying agent hooks, and excluding noisy graph data from agent search. Also fixes a correctness issue by removing outdated OpenSpec skills that violated the archive ceremony, with .omp/ now the single source of truth.

  • Refactors

    • Centralized agent guidance in AGENTS.md with key gotchas (E2E shell binary, 500-line cap/escape, capability-map markers, threat-claims test names, canon logs precedence); CLAUDE.md now imports it.
    • Deleted OpenSpec v1.3.1 skills and commands from .claude, .codex, .opencode that instructed forbidden raw moves and referenced banned commands; keep .omp/ (1.6.0-beta.1) as the maintained copy; archive rule documented in AGENTS.md.
    • Added .ignore to exclude graphify-out/cache/, dated subfolders, and graphify-out/graph.json from agent glob/grep, cutting matches under graphify-out/**/*.json from ~2,580 to 3; git tracking and the graphify pre-commit hook remain unchanged.
    • Removed PreToolUse nag hooks; tool descriptions are simple and graph guidance is optional; dropped the dead graphify-out/wiki/index.md reference.
  • Verification

    • Gate checks pass: ceremony, file-size cap, capability-map (and tests), openspec validate --all --strict (46/0).
    • No Rust or Cargo files changed; fmt/clippy/cargo test unaffected.

Written for commit 6bdb935. Summary will update on new commits.

Review in cubic

AGENTS.md carried no codebase gotchas -- eight lines, all graphify. Every
landmine in this repo (prebuilt shell binary for the kernel E2E, the
500-line cap escape hatch, capability-map generated markers, threat-claims
test rows, canon-beats-sequence-file) was discoverable only by burning a
full check.sh cycle. Rewritten around those.

.claude/.codex/.opencode carried openspec 1.3.1 skills instructing
`mv openspec/changes/<name> openspec/changes/archive/...` -- the raw-move
ceremony check-omp-ceremony.sh forbids, but only guards in .omp/. Archiving
from those harnesses left spec deltas unapplied. Deleted; .omp/ (1.6.0-beta.1,
hand-patched) is the single maintained copy, and the CLI-archive rule now
lives in AGENTS.md so it survives regeneration in any harness.

Also:
- .ignore keeps generated graph data out of agent search. 2,528 of 3,451
  tracked files were graphify-out/cache content-addressed blobs (92MB);
  glob hits under graphify-out drop from 2,580 to 3. Git-neutral.
- Dropped the PreToolUse hooks that re-injected the same graphify sentence
  on every Glob|Grep (.claude) and every Bash (.codex).
- Graphify guidance reframed from a mandatory 235KB read before any
  architecture question to available-if-useful; dropped the dead
  graphify-out/wiki/index.md reference.
- CLAUDE.md was byte-identical to AGENTS.md; now imports it.

Gate: check-omp-ceremony, check-file-sizes, capability-map + tests, and
openspec validate --all --strict all pass. No .rs or Cargo.* touched.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@George-RD
George-RD merged commit 3e8f4bf into main Aug 7, 2026
1 of 2 checks passed
@George-RD
George-RD deleted the agent/rightsize-agent-context branch August 7, 2026 08:23
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 54be21fb-5edc-4047-bef6-7c4f715ee0ef

📥 Commits

Reviewing files that changed from the base of the PR and between 1e4e257 and 6bdb935.

📒 Files selected for processing (36)
  • .claude/commands/opsx/apply.md
  • .claude/commands/opsx/archive.md
  • .claude/commands/opsx/explore.md
  • .claude/commands/opsx/propose.md
  • .claude/settings.json
  • .claude/skills/openspec-apply-change/SKILL.md
  • .claude/skills/openspec-archive-change/SKILL.md
  • .claude/skills/openspec-explore/SKILL.md
  • .claude/skills/openspec-propose/SKILL.md
  • .codex/hooks.json
  • .codex/skills/openspec-apply-change/SKILL.md
  • .codex/skills/openspec-archive-change/SKILL.md
  • .codex/skills/openspec-explore/SKILL.md
  • .codex/skills/openspec-propose/SKILL.md
  • .ignore
  • .opencode/commands/opsx-apply.md
  • .opencode/commands/opsx-archive.md
  • .opencode/commands/opsx-explore.md
  • .opencode/commands/opsx-propose.md
  • .opencode/skills/openspec-apply-change/SKILL.md
  • .opencode/skills/openspec-archive-change/SKILL.md
  • .opencode/skills/openspec-explore/SKILL.md
  • .opencode/skills/openspec-propose/SKILL.md
  • AGENTS.md
  • CLAUDE.md
  • graphify-out/.graphify_labels.json
  • graphify-out/2026-08-07/.graphify_labels.json
  • graphify-out/2026-08-07/GRAPH_REPORT.md
  • graphify-out/2026-08-07/graph.json
  • graphify-out/2026-08-07/manifest.json
  • graphify-out/GRAPH_REPORT.md
  • graphify-out/cache/ast/v0.9.10/0cd76b025fdde9fe0a42ecda0f39c34a1cf472c9ef2239117c504289e68c2156.json
  • graphify-out/cache/ast/v0.9.10/1bc407b3dec76c32f03d0e5e2d064ceae04ede1709e79f8ce2383f5b4092e7a6.json
  • graphify-out/cache/stat-index.json
  • graphify-out/graph.json
  • graphify-out/manifest.json

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Consolidated repository guidance covering structure, trust boundaries, testing, CI checks, generated files, workflows, and operational documentation.
    • Simplified assistant instructions by centralizing them in the primary repository guidance.
  • Chores

    • Removed obsolete workflow commands, skills, and related hook configurations.
    • Added ignore rules for generated graph output and cache files.
    • Refreshed repository metadata and generated graph reports.

Walkthrough

This change removes OpenSpec commands, skills, and hook configurations across supported tool integrations. It consolidates repository guidance in AGENTS.md, delegates CLAUDE.md to that guidance, updates ignore rules, and regenerates graphify artifacts.

Changes

Repository workflow cleanup

Layer / File(s) Summary
OpenSpec workflow removal
.claude/..., .codex/..., .opencode/...
OpenSpec apply, archive, explore, and propose commands and skills are deleted. Claude and Codex hook configurations are also removed.
Repository guidance consolidation
AGENTS.md, CLAUDE.md, .ignore
AGENTS.md now contains repository architecture, validation, testing, generated-file, OpenSpec, version, documentation, and graphify guidance. CLAUDE.md references AGENTS.md. .ignore excludes graphify cache and generated output paths.
Graphify artifact refresh
graphify-out/...
Graph labels, reports, manifests, AST cache entries, community data, and knowledge-gap data are regenerated for the updated repository contents.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • George-RD/openspine#37: Added the OpenSpec OpsX commands and skills that this change removes across tool integrations.

Poem

A rabbit found old workflows in a row,
And watched the OpenSpec pages go.
“AGENTS guides the way,”
Said the graph files that day,
While clean caches quietly grow.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/rightsize-agent-context

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant