or Space · N notes
A comprehensive primer on setting up developer workflows, agent development lifecycles, and 2 common agentic engineering harnesses.
April 2026 · Claude Code · OpenCode
Why Agentic Engineering?
Coding agents are autonomous collaborators that read your codebase, execute commands, and verify their own work. Configuration is the difference between a junior pair-programmer and a senior engineer.
60%
Less time on boilerplate tasks
3–5×
Faster PR throughput
40%
Fewer context switches
Configuring your harness is the precursor to designing agentic systems and running reliable, long-running autonomous sessions that meet your standards.
What We'll Cover
Directory Structure
Where configuration lives
Agents & Subagents
Specialised task workers
Project Instructions
CLAUDE.md & AGENTS.md
Hooks & Automation
Lifecycle event handlers
Settings & Permissions
Controlling agent access
MCP, Tools & Plugins
External integrations
Rules & Skills
Modular, reusable knowledge
Development Lifecycle
Team adoption workflow
The Agent Configuration Directory
Claude Code
.claude/settings.json
.claude/rules/
.claude/skills/
.claude/agents/
.claude/commands/
.claude/agent-memory/
CLAUDE.md
.mcp.json
OpenCode
.opencode/ + opencode.json
.opencode/agents/
.opencode/skills/
.opencode/commands/
.opencode/tools/
.opencode/plugins/
.opencode/modes/
AGENTS.md
Both tools share the Agent Skills open standard. OpenCode also reads CLAUDE.md and ~/.claude/skills/ for compatibility.
Project Instructions: The Most Important File
CLAUDE.md (or AGENTS.md) is loaded into every session. It tells the agent how to build, test, and follow your conventions.
Build & Test Commands
npm run dev, npm test, lint — so the agent never guesses
Architecture Overview
Tech stack, directory layout, key modules
Coding Conventions
Naming, error handling, import style, forbidden patterns
Non-Obvious Gotchas
"Tests use a real DB", "Never import X from Y"
Keep under 200 lines. Split into .claude/rules/ or skills when it grows.
Settings & Permissions
Control what the agent can and cannot do. Deny rules always win over allow rules.
AllowAgent can use the tool without askingBash(npm run test *)
AskAgent must request approval each timeBash(rm *)
DenyTool is blocked — cannot be used at allRead(./.env)
Settings cascade: Managed (highest) → Project → User (lowest). Deny at any level blocks the tool everywhere.
Permissions in Practice
.claude/settings.json
{ "permissions": { "allow": [ "Bash(npm run test:*)", "Bash(git:*)", "Read" ], "ask": [ "Bash(npm publish:*)" ], "deny": [ "Read(.env*)", "Read(secrets/)" ] } }
Prefix wildcards
Bash(git:*) matches git status, git commit, etc.
Tool-only rules
Read with no args allows all read operations.
Three settings files
Managed (admin) → .claude/settings.json (team) → settings.local.json (personal)
Deny always wins
Even in bypass mode, deny rules cannot be overridden.
Rules — Modular, Conditional Instructions
Split large instruction sets into focused markdown files. Rules can be scoped to specific file paths so they only load when relevant.
.claude/rules/
├── code-style.md
├── testing.md
├── api-conventions.md
├── frontend/
│ └── react-patterns.md
└── backend/
└── db-queries.md
One topic per file
Descriptive filenames for easy scanning
Path scoping (globs)
Load only for matching files
Recursive discovery
Subdirectories auto-discovered
Always-on or on-demand
Rules load every session; skills load when needed
Skills — Reusable Workflows & Knowledge
Each skill is a directory with a SKILL.md file. They can be invoked as slash commands or auto-loaded by the agent when the task matches.
Skill Anatomy
---
name: deploy
description: Deploy to staging
allowed-tools: Bash(git *)
---
Run the deploy pipeline...
1. Pull latest main...
2. Run npm run build...
/deploy
You invoke it directly as a slash command
Auto-loaded
Agent detects relevance from your prompt
Subagent context
Injected into a subagent's startup context
Model-invocation
Agent calls the Skill tool programmatically
Skills follow the open Agent Skills standard — compatible across Claude Code, OpenCode, and Codex.
Agents & Subagents — Specialised Workers
Subagents run in isolated context with their own tools, models, and permissions.
Code Reviewer
Read-only. Scans diffs for bugs and security.
Explore
Answers contextual questions, keeps main context lean.
Sprint Planner
Decomposes epics into tasks with estimates.
Technical Writer
Maintains docs, READMEs, and ADRs.
QA Guardian
Test plans, e2e tests, edge case hunting.
Researcher
Deep-dives into docs, APIs, and codebases.
Frontmatter: name, description, model, tools, permissionMode, hooks, skills, maxTurns, memory
Defining a Subagent
.claude/agents/why.md
--- name: why description: Reviews code in the spirit of _why model: sonnet tools: - Read - Glob - Grep - Bash(git diff:*) disallowedTools: - Edit - Write permissionMode: plan --- You are a code reviewer channelling why the lucky stiff. Review with wonder, kindness, and a poetic eye. Celebrate clever simplicity. Question unnecessary complexity. If code sparks joy, say so. If it lost its way, guide it home with a story, not a lecture.
Frontmatter = config
Model, tools, permissions — all declared in YAML header.
Body = system prompt
Markdown below the frontmatter becomes the agent's instructions.
Tool restrictions
tools whitelists, disallowedTools blacklists. Both are optional.
Invocation
Use the Agent tool with subagent_type or let the main agent delegate automatically.
Hooks — Lifecycle Automation
Hooks fire at specific lifecycle points — deterministic control that doesn't rely on the LLM to choose.
SessionStart
Session begins
PreToolUse
Before a tool executes
PostToolUse
After a tool completes
Stop
Agent finishes its turn
Command
Shell script — receives JSON on stdin, returns via exit code
HTTP
POST to a URL — same JSON format, response as body
Prompt / Agent
LLM evaluates a condition, returns yes/no decision
Plugin Events
JS/TS module subscribes to tool.execute.before/after events (OpenCode)
Hooks in Practice
.claude/settings.json → hooks
{ "hooks": { "PostToolUse": [{ "matcher": "Write|Edit", "hooks": [{ "type": "command", "command": "prettier --write \"$FILE\"" }] }], "PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "prompt", "prompt": "Is this safe? $ARGS" }] }] } }
Auto-format on save
PostToolUse on Write|Edit runs prettier after every file change. Deterministic, not LLM-dependent.
Safety gate
PreToolUse prompt hook asks an LLM to evaluate bash commands before execution.
Matcher syntax
Pipe-separated tool names. Write|Edit fires on either tool.
Hook types
command runs shell, prompt asks LLM, agent spawns a subagent, http calls a URL.
Custom Commands — Your Team's Shortcuts
Every markdown file in commands/ becomes a slash command. Standardise repetitive workflows.
/project:review
Diff against main, review for bugs and security
/project:fix-issue
Take a GitHub issue, reproduce, fix, create PR
/project:deploy
Staging deploy pipeline with pre-flight checks
/project:onboard
Explain architecture, key patterns, and dev setup
MCP Servers, Custom Tools & Plugins
MCP Servers
• Databases, APIs, Slack, GitHub
• Local (stdio) or remote (HTTP/SSE)
.mcp.json / opencode.json
• Tools auto-available to agents
Custom Tools
• OpenCode: .opencode/tools/
• TypeScript/JS with Zod schemas
• Can invoke scripts in any language
• Claude Code: via MCP or plugins
Plugins
• Bundle skills + hooks + agents + MCP
• Share across projects & teams
• Marketplaces, git repos, or npm
• Namespaced to avoid conflicts
Modes & Output Styles
Modes restrict tools and set system prompts. Output styles change tone without changing capabilities.
Build
All tools enabled. Default for development work.
Plan
Read-only analysis. No file edits, no destructive commands.
Review
Code review focus. Read + documentation tools only. (OpenCode)
Debug
Investigation mode. Bash + read tools, no writes. (OpenCode)
Default
Standard coding assistant output
Explanatory
Adds educational insights
Learning
Collaborative, includes TODO(human)
Custom
Your own markdown definitions
Memory — Persistent Learning Across Sessions
Each session starts fresh. Memory bridges the gap — accumulating project knowledge over time.
Auto-Memory
Saves observations automatically — commands, patterns, architecture. Stored in ~/.claude/projects/ with MEMORY.md index. First 200 lines / 25 KB load each session.
Auto-Dream
Background memory consolidation between sessions. Claude reviews transcripts, extracts insights, and updates memory files while you're away. Enable with autoDreamEnabled.
Memory types: user, feedback, project, reference. Auto-memory is for the main agent — subagent memory is configured separately.
Agent Memory — Opt-In Per Subagent
Subagents can persist their own knowledge across invocations. Enable with the memory frontmatter field — the agent reads MEMORY.md at startup and writes observations automatically.
.claude/agents/researcher.md
--- name: researcher description: Deep-dives into docs and APIs model: sonnet memory: project tools: - Read - Glob - Grep - WebFetch --- Research the topic thoroughly. Track findings in your memory.
project
.claude/agent-memory/<name>/ — committed to git. Whole team benefits from accumulated knowledge.
local
.claude/agent-memory-local/<name>/ — gitignored. Personal notes only you can see.
user
~/.claude/agent-memory/<name>/ — global across all projects on your machine.
Read, Write, and Edit tools are auto-enabled for agents with memory. The agent decides what's worth remembering.
The Agent Development Lifecycle
01
Bootstrap
Run /init to generate CLAUDE.md / AGENTS.md from your codebase
02
Configure
Set permissions, add rules, define skills and subagents
03
Integrate
Connect MCP servers, add custom tools, install plugins
04
Iterate
Use the agent daily. Refine instructions from feedback and memory
05
Scale
Commit config to git. Onboard team. Add managed policies.
This is not a one-time setup. The best agent configurations evolve continuously as the team learns what works.
Claude Code vs OpenCode
FeatureClaude CodeOpenCode
Project instructionsCLAUDE.mdAGENTS.md
Settings filesettings.jsonopencode.json
Rules directory✓ Built-in, path-scopedVia plugin
Skills✓ Agent Skills standard✓ Agent Skills standard
Agents / Subagents✓ .claude/agents/✓ .opencode/agents/
HooksJSON: cmd, HTTP, prompt, agentJS/TS plugin event system
Custom slash commands✓ commands/ (merged w/ skills)✓ commands/
Custom tools directory— (via MCP)✓ .opencode/tools/
ModesOutput styles✓ .opencode/modes/
Themes✓ .opencode/themes/
Agent memory✓ Built-in auto-memoryVia plugin (letta-memory)
PluginsMarketplace + git reposnpm packages + local JS/TS
LLM providersAnthropic (+ Bedrock/Vertex)Any (Anthropic, OpenAI, etc.)
Best Practices for Your Team
Commit config to git
CLAUDE.md, settings, skills, agents — use .local files for personal prefs.
Start with daily workflows
PR review, test writing, deployment — automate what you repeat most.
Keep instructions concise
Under 200 lines. Write what the agent can't infer from code.
Iterate from corrections
Every correction is a config improvement. Formalise auto-memory patterns.
Deny rules for safety
Block .env, secrets/, sensitive paths. Deny always wins.
Scope permissions tightly
Allow only what's needed. Expand as trust builds.
Getting Started — This Week
1
Run /init in your project
Generate a starting CLAUDE.md / AGENTS.md from your codebase. Commit it to your repo.
2
Add your build & test commands
Ensure the agent knows how to build, test, lint, and deploy. This alone eliminates most wrong guesses.
3
Set sensible permissions
Deny access to secrets and sensitive files. Allow common safe commands (git, npm test) without prompting.
4
Create one team skill
Pick your most common workflow — PR review is a great first skill. Share it with the team.
5
Use it for a real task
Don't sandbox it in a toy project. Use the agent on real work and note where it stumbles — that's your next config improvement.
The best time to configure your agent was when you started using it. The second best time is now.
Start Building With Your Agent
Questions? Let's configure your first agent together.