Python toolkit for building AI agent systems with Claude Code — MCP servers, orchestration, skills, and hooks
Project description
AI Agent Systems Lab
A hands-on learning environment for modern AI agent engineering using Claude Code's native runtime — skills, hooks, sub-agents, MCP servers, agent teams, and context engineering.
Built to practice the patterns that are replacing static LangChain-style prompt pipelines with runtime-native orchestration.
What's Inside
Skills (Reusable Agent Workflows)
| Skill | What It Does |
|---|---|
deep-review |
Multi-agent code review (context researcher + security auditor + synthesis) |
debug-agent |
Hypothesis-driven debugging with parallel investigation agents |
onboard-repo |
4-agent parallel codebase mapping for unfamiliar repos |
pr-analyzer |
PR quality analysis (logic + design + risk assessment) |
feature-builder |
End-to-end feature delivery with plan→execute→validate pipeline |
build-skill |
Meta-skill for creating new skills |
Hooks (Deterministic Lifecycle Guardrails)
| Hook | Event | Purpose |
|---|---|---|
safety-check.sh |
PreToolUse | Block force pushes, destructive rm, dangerous git ops |
env-protection.sh |
PreToolUse | Block secrets in file writes, detect hardcoded API keys |
audit-log.sh |
PostToolUse | Async logging of all tool executions |
compaction-saver.sh |
PreCompact | Save state before context window compaction |
quality-gate.sh |
Stop | Notify when agent completes work |
MCP Server (Custom Tool Extension)
mcp-servers/task-tracker/ — A production MCP server built with the official Python SDK (FastMCP):
- 6 tools: add, list, complete, delete, bulk_add, get_summary
- Resources: lazy-loaded task data
- Prompts: standup report generator, prioritization helper
- Full integration test harness
Slash Commands (Project Workflows)
| Command | What It Does |
|---|---|
/project:agent-team |
Full research→plan→execute→validate pipeline |
/project:smart-do |
Dynamic routing — classifies complexity, deploys right level of machinery |
/project:research |
Parallel sub-agent research with synthesis |
/project:explain |
Explains agent concepts with diagrams and token implications |
/project:context-audit |
Audits current context window utilization |
Agent Definitions
Documented patterns for building agent teams:
- Researcher — Deep codebase exploration without context pollution
- Planner — Concrete implementation plans from synthesized research
- Executor — Isolated code changes (worktree support)
- Validator — Independent verification (fresh eyes, no confirmation bias)
- Coordinator — Runtime orchestration pattern (the parent context)
Architecture
┌── Claude Code Session (Coordinator) ─────────────────────────┐
│ │
│ Context Window │
│ ├── System prompt (~4K tokens) │
│ ├── CLAUDE.md (project rules, always loaded) │
│ ├── Memory index (cross-session knowledge) │
│ ├── Skill descriptions (lazy routing metadata) │
│ └── Conversation + tool results (growing, compacted) │
│ │
│ Orchestration: runtime decisions between phases │
│ ├── Spawn sub-agents (isolated context windows) │
│ ├── Fan-out parallel research │
│ ├── Synthesize findings (never delegate understanding) │
│ └── Checkpoint with user at critical junctures │
│ │
│ External: │
│ ├── Hooks (deterministic, zero token cost, shell scripts) │
│ ├── MCP servers (tool extension via stdio protocol) │
│ └── Files (persistence beyond context compaction) │
└───────────────────────────────────────────────────────────────┘
Key Concepts
Why Runtime Orchestration > Static Pipelines
# OLD: Static pipeline (LangChain-style)
chain = research | plan | execute | validate # same path every time
chain.invoke("add a semicolon") # overkill
chain.invoke("rewrite auth system") # underkill
# NEW: Runtime orchestration (agent-native)
# Coordinator classifies, adapts, skips, retries based on actual results
# "Add semicolon" → direct edit (500 tokens)
# "Rewrite auth" → full team pipeline (3000 tokens, correct result)
Context Engineering Principles
- CLAUDE.md = always loaded → keep it SHORT (build commands + critical rules only)
- Memory = cross-session knowledge → index is cheap, content loads on demand
- Skills = lazy-loaded workflows → descriptions route, full instructions load on invoke
- Sub-agents = context isolation → intermediate results stay in child, parent gets summary
- Hooks = zero context cost → deterministic enforcement outside the LLM
Token Budget Mental Model
| Component | Cost | When |
|---|---|---|
| Sub-agent result | 200-1000 tokens | Once when it returns |
| File read | 500-5000 tokens | Once per read |
| CLAUDE.md | 200-2000 tokens | EVERY turn |
| Skill invocation | 500-2000 tokens | On invoke |
| Hook execution | 0 tokens | Always free |
Getting Started
Use the lab
cd ~/Documents/GitHub/agent-lab
# Claude Code auto-loads .claude/settings.json, CLAUDE.md, .mcp.json
# All hooks, permissions, and MCP servers activate automatically
Try the commands
/project:research MCP protocol architecture
/project:explain context compaction
/project:smart-do add a health check endpoint
/project:agent-team implement user preferences feature
/project:context-audit
Connect the MCP server
The task-tracker MCP server connects automatically when you start Claude Code in this directory. Approve it when prompted.
# Test it manually:
cd mcp-servers/task-tracker
uv run python test_server.py
Project Structure
agent-lab/
├── CLAUDE.md ← Project conventions (always loaded)
├── .mcp.json ← MCP server configurations
├── .claude/
│ ├── settings.json ← Hooks, permissions, project config
│ └── commands/ ← Slash commands (/project:*)
├── skills/ ← Reusable skill definitions (SKILL.md)
├── agents/ ← Agent architecture documentation
├── hooks/ ← Shell scripts for lifecycle events
├── mcp-servers/
│ └── task-tracker/ ← Working MCP server (Python/FastMCP)
├── experiments/
│ ├── 01-context-engineering/ ← How the context window works
│ ├── 02-skill-system/ ← Skill loading & routing
│ ├── 03-hooks/ ← All hook types & lifecycle events
│ ├── 05-memory-engineering/ ← Memory architecture & examples
│ └── 06-runtime-orchestration/← Runtime vs static pipelines
└── docs/
├── architecture.md ← Master architecture reference
└── quick-reference.md ← Decision cheatsheet
Learning Path
- Context Engineering →
experiments/01-context-engineering/ - Sub-Agents →
agents/researcher.md,agents/coordinator.md - Skills →
experiments/02-skill-system/,skills/*/SKILL.md - Hooks →
experiments/03-hooks/HOOK_TYPES.md,hooks/*.sh - MCP →
experiments/04-mcp-architecture/,mcp-servers/task-tracker/ - Memory →
experiments/05-memory-engineering/ - Runtime Orchestration →
experiments/06-runtime-orchestration/
Resources
Core Documentation:
Agent Harness Comparison:
- Three Kingdoms of CLI Agents — Claude Code vs OpenCode vs Pi philosophy comparison (read first)
- OpenCode (sst) — configurable agent product
- Pi (Mario Zechner) — minimal programmable harness
Deep Dives:
- Skills Complete Guide (PDF)
- Hooks Mastery
- Sub-agents & Skills Guide
- Agent Teams Guide
- Agent Loops & Tool Calls
- Build Custom Agent Framework
- Claude Code Skills, Subagents, Hooks Overview
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_agent_lab-0.2.0.tar.gz.
File metadata
- Download URL: ai_agent_lab-0.2.0.tar.gz
- Upload date:
- Size: 161.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d97e942e33e6157b00251ec462dbb19756cc8b8269ac28b5873a8d5752329cd2
|
|
| MD5 |
8fbadaee9380c2c48d1710e9866a8923
|
|
| BLAKE2b-256 |
e8c21607c4282cb248f463206a9ac86280dc1042442e72ec5d48a6fba6a88a2b
|
Provenance
The following attestation bundles were made for ai_agent_lab-0.2.0.tar.gz:
Publisher:
ci.yml on Akkikens/agent-lab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_agent_lab-0.2.0.tar.gz -
Subject digest:
d97e942e33e6157b00251ec462dbb19756cc8b8269ac28b5873a8d5752329cd2 - Sigstore transparency entry: 1594905659
- Sigstore integration time:
-
Permalink:
Akkikens/agent-lab@1597bc7bd753a4d07f16d62425d0377d754b98ae -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Akkikens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1597bc7bd753a4d07f16d62425d0377d754b98ae -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_agent_lab-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ai_agent_lab-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e19c57322092617f193d7e399b83bb5cc7a7aeab1fb340981e73db2288d5aeee
|
|
| MD5 |
609636a5b4dcdf94fc50a3aa74045e66
|
|
| BLAKE2b-256 |
2487c2c05bab9f9f57c4cbc100a5eaa9b96b9d80173e20c9b555fe43b5472f70
|
Provenance
The following attestation bundles were made for ai_agent_lab-0.2.0-py3-none-any.whl:
Publisher:
ci.yml on Akkikens/agent-lab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_agent_lab-0.2.0-py3-none-any.whl -
Subject digest:
e19c57322092617f193d7e399b83bb5cc7a7aeab1fb340981e73db2288d5aeee - Sigstore transparency entry: 1594905713
- Sigstore integration time:
-
Permalink:
Akkikens/agent-lab@1597bc7bd753a4d07f16d62425d0377d754b98ae -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Akkikens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1597bc7bd753a4d07f16d62425d0377d754b98ae -
Trigger Event:
push
-
Statement type: