09. Study Exercises and Skill Gains

What This Source Can Improve

  • Designing serious terminal products rather than simple scripts.
  • Structuring tool contracts and permission contexts.
  • Building safer shell execution layers.
  • Designing model adapter layers that survive real auth and provider complexity.
  • Managing long-session state, history, compacting, and UX continuity.

Exercises

  1. Draw the startup flow from main.tsx in your own diagram with “before first render” and “after first render” lanes.
  2. List every check that stands between a model-generated shell command and actual execution.
  3. Recreate a simplified Tool.ts contract for your own agent project.
  4. Write a mini decision table for allow / ask / deny around one dangerous tool.
  5. Summarize the difference between “UI shell,” “tool bus,” and “model adapter” in one paragraph each.

If You Already Have Your Own Agent Framework

If you already have something like a local Qwen-powered terminal agent, the most transferable parts of this source are not the model calls. The best parts to learn from are:

  • How the CLI shell is organized as a product
  • How Bash and file tools are fenced with policy
  • How session state is made durable and recoverable
  • How trust and approvals are built into the workflow

Final Study Rule

Do not read this source as “secret sauce.” Read it as a mature example of system decomposition. The skill gain comes from seeing how a large CLI agent product is partitioned into boot flow, contracts, tools, permissions, adapters, UI, and long-session state.

Source Navigation

Recommended Source Files

  • source/main.tsx
  • source/tools/BashTool/BashTool.tsx
  • source/services/api/client.ts
  • source/tools/FileReadTool/FileReadTool.ts
  • source/services/SessionMemory/sessionMemory.ts

Next Files to Read

  • source/tools/FileEditTool/FileEditTool.ts
  • source/tools/AgentTool/AgentTool.tsx
  • source/services/mcp/auth.ts