From nexus-agents
Curates Claude agent context hierarchy: rules files, persistent memory, specs, source code, and live state. Use when starting sessions, fixing output drift, fanning out subagents, or project setup.
npx claudepluginhub williamzujkowski/nexus-agentsThis skill is limited to using the following tools:
<!--
Optimizes AI agent context setup with rules files (CLAUDE.md), specs, source files, and hierarchy. Use for new sessions, degrading output, task switches, or project configuration.
Installs bundles of skills for LLM context engineering, multi-agent architectures, memory systems, tool design, and agent evaluation in Claude Code and Cursor.
Teaches context engineering ops: Write to persist, Select relevant info, Compress tokens, Isolate to manage budgets and keep AI coding sessions efficient.
Share bugs, ideas, or general feedback.
1. Rules files CLAUDE.md, AGENTS.md, .rules/*.md
2. Memory ~/.claude/projects/.../memory/MEMORY.md + topic files
3. Spec / architecture docs/architecture/*.md, ADRs (loaded per feature)
4. Relevant source source files for the task (loaded per task)
5. Live state error output, test results (loaded per iteration)
6. Conversation accumulates, compacts automatically
Higher levels persist across sessions; lower levels are transient. Engineer the higher levels well — they pay for themselves on every future session.
Project-wide, always loaded. nexus-agents canonical:
CLAUDE.md — prime directive, type-safety policy, anti-sprawl, autonomous-loop rules, tooling commandsAGENTS.md — per-skill routing keywords for non-Claude tools.rules/*.md — auto-loaded per-topic rules (typescript.md, git.md, subagent-coordination.md, untrusted-input.md, etc.)Edits here have repo-wide leverage. Treat with care: these are the single biggest input to every future session.
Per-user, cross-session. ~/.claude/projects/-home-william-git-nexus-agents/memory/:
MEMORY.md — index, always loaded. Keep entries to one line < 200 chars.<topic>.md — detail loaded on relevance.CLAUDE.md "auto memory" for what to save (user/feedback/project/reference) and what NOT to save (anything derivable from git log or current files).Memory is a point-in-time observation, not live state. Verify against current code before asserting facts from a stale memory.
Load the relevant section, not the entire 5000-word spec. ADR-shaped docs in docs/adr/ are short by design — load freely. Architecture docs in docs/architecture/ are larger — load only what applies.
Before editing a file, read it. Before introducing a pattern, find an existing example via Grep. nexus-agents canonical paths are tabulated in CLAUDE.md ("Canonical Paths") — start there for module discovery.
Test output, lint errors, CI logs, current git status. Capture once, summarize, don't keep re-fetching.
Auto-compacts as it grows. Per CLAUDE.md "Context management": when working with tool results, write down important info in your response — the original tool result may be cleared later.
Per CLAUDE.md "Subagent Context Management" + .rules/subagent-coordination.md:
src/consensus/") over codebase-wide sweeps. For whole-repo tasks, partition by top-level dir, one agent per partition.## Status: complete | blocked — <reason> | partial — cutoff at X of Y. Blockers surface in the same response, not silently.## Discoveries section for bugs found outside their scope. Parent agent re-verifies before filing (the 4-point gate in CLAUDE.md "Discovered Issues").When context conflicts or a requirement is ambiguous, don't silently pick. Surface it:
CONFUSION:
- The CLAUDE.md prime directive says "correctness > simplicity > performance"
- The performance-optimization skill says we should optimize hot paths
- This change adds 40 LOC of micro-optimization to a path with no perf evidence
Options:
A) Apply the optimization — defends a future hot path
B) Skip the optimization — no current evidence of slowness
C) Add a perf benchmark first to gather evidence
→ Which approach do you want?
When a requirement is missing, don't invent it. Ask. The human's job is to define requirements; the agent's job is to implement them.
For multi-step tasks, emit a lightweight plan before executing:
PLAN:
1. Add Zod schema for task creation — title required, description optional
2. Wire schema into POST /api/tasks route handler
3. Add test for the validation error response
→ Executing unless you redirect.
A 30-second plan catches wrong directions before you've built on them. Saves 30 minutes of rework.
| Excuse | Counter |
|---|---|
| "The agent should figure out the conventions" | It can't read your mind. Write the rules file. 10 minutes upfront saves hours of correction. |
| "I'll correct it when it goes wrong" | Prevention is cheaper than correction. Drift compounds across iterations. |
| "More context is always better" | Performance degrades with non-relevant context. Aim for ~2,000 lines of FOCUSED context per task. |
| "The context window is huge, I'll use it all" | Window size ≠ attention budget. Focused context outperforms large context. |
| "I'll just have one giant subagent do it all" | One 50k-token subagent return == catastrophic context flood. Wave of 3-4 with bounded outputs. |
| "I'll let the subagent decide what's relevant" | The subagent can't see your goal. State the question, the scope, and the output budget explicitly. |
| Anti-pattern | Symptom | Fix |
|---|---|---|
| Context starvation | Agent invents APIs, ignores conventions | Load rules + relevant source before each task |
| Context flooding | Agent loses focus with > 5k lines of irrelevant context | Include only what's relevant; aim < 2k focused lines per task |
| Stale context | Agent references deleted code or old patterns | Start fresh session when switching unrelated tasks |
| Missing examples | Agent invents new style instead of following yours | Include one example of the canonical pattern |
| Implicit knowledge | Agent doesn't know project-specific rules | Write it down. "Tribal knowledge" doesn't survive a session boundary. |
| Silent confusion | Agent guesses when it should ask | Surface ambiguity using the Confusion-management pattern |
| Subagent flood | Wave of 6+ parallel agents → parent context exhausted | Wave-of-3-4 max. Summarize each result to 2-3 bullets in parent. |
CLAUDE.md, AGENTS.md, relevant .rules/*.md) loaded at session startMEMORY.md index reviewed for relevant prior context