Context Course documentation
Quiz 2: Hooks in Practice
0. Welcome to the Context Course
1. Skills: Portable Knowledge for Code Agents
2. MCP: The Model Context Protocol
3. Plugins: Bundling Tools for Distribution
4. Subagents: Orchestrating Multi-Agent Workflows
5. Hooks: Observing and Guarding the Agent Lifecycle
Unit 5: HooksHook Events and the Agent LifecycleQuiz 1: Hook FundamentalsHands-On: Agent Activity Dashboard with GradioQuiz 2: Hooks in Practice
6. Bonus: Nano Harness — Build Your Own Agent
Quiz 2: Hooks in Practice
Test your ability to wire hooks into real workflows.
Question 1: How should the dashboard server be structured?
Question 2: How does the Gradio dashboard refresh?
Question 3: How do hook-based guardrails block dangerous actions?
Question 4: What makes shell-command hooks safe?
Question 5: Why can one dashboard support multiple agents?
Summary
If you got 4-5 correct, you can wire hooks into a real observability and guardrail flow. If not, review the hands-on example, especially the payload normalization and blocking patterns.
Key Takeaways
- One FastAPI + Gradio process is enough for a lightweight live dashboard
- Hook handlers should fail fast, sanitize payloads, and avoid shell-injection patterns
- A shared receiver works across Claude Code, Codex, OpenCode, and Pi once you normalize the event shape
What’s Next
You’ve finished Unit 5: Hooks. You now have five end-to-end surfaces for shaping how a code agent works: skills, MCP servers, plugins, subagents, and hooks. The bonus unit goes one level deeper and builds an agent from scratch, so you understand what every one of those surfaces is plugging into.
Update on GitHub