Part I: Principles and mechanisms
1. Forms of agent software

1. GUI: AI IDEs based on open-source VS Code

2. CLIs running on a server or VPS


3. Native desktop apps

2. The basic structure of an agent
1. Basic architecture
An agent ≈ LLM + tools + context management + a ReAct loop.

2. LLM capabilities: What powers the agent
2.1 Model capabilities and tools
AI platforms list model capabilities on their API pricing pages. A few representative screenshots show what an agent is built on.

2.2 Structured output and tool calling (function calling)
Structured output usually means JSON output in the LLM context. It is what carries tool calls. Without reliable structured output, calls fail frequently, the ReAct loop stalls, and the agent cannot be relied on.
Tool calling is how the model asks to take action. It uses structured output to specify the tool and its arguments.
It resembles one service making an RPC to another, except the model generates the request. The agent client parses the arguments, executes the tool, and feeds the result back to the model.





3. The agent’s inputs: Context windows and prompt management
A context window is all the text a language model can refer to when generating a response, including the response itself.
—— Claude API Docs
- The context window includes the system prompt, conversation history, tool results, and file contents. A text prompt is the only way the outside world interacts with the LLM.

3. What agents can do and how they work
1. “Omnipotent” LLMs and concrete requirements




2. Agent mechanisms and hard and soft constraints
Hard constraints versus soft rules

Three layers of mechanisms

How five agent tools implement these mechanisms
The table compares where each mechanism lives, what format it uses, and whether it enforces requirements across Claude Code, Codex (OpenAI CLI), OpenCode (sst/opencode), Cursor, and Trae. The comparison draws on official documentation and open-source repositories.
Comparison matrix
| Mechanism | Claude Code | Codex | OpenCode | Cursor | Trae |
|---|---|---|---|---|---|
| Persistent knowledge | CLAUDE.mdProject, user, and enterprise levels | AGENTS.mdSubdirectory overrides via AGENTS.override.md | AGENTS.mdBackward compatible with CLAUDE.md | Plain Markdown AGENTS.md at the project root | .trae/rules/project_rules.md and user_rules.md |
| Skills | .claude/skills/<name>/SKILL.mdFollows the Agent Skills open standard | .agents/skills/<name>/SKILL.mdFrontmatter requires name and description | Supports .opencode/, .claude/, and .agents/ | .cursor/skills/<name>/SKILL.md and ~/.cursor/skills/ | Project skills under .trae/skills/. User skills under ~/.trae/skills/ on macOS and Linux or %userprofile%/.trae/skills/ on Windows. |
| Rules | .claude/rules/*.mdTriggered by globs in frontmatter paths: | Uses AGENTS.md and Skills | The documentation calls AGENTS.md “Rules” | .cursor/rules/*.mdcFour trigger modes: always, glob, agent-requested, and manual with @ | .trae/rules/, alongside persistent knowledge |
| Hooks | settings.jsonMore than 30 events and three hook types | ~/.codex/hooks.json or TOMLSix events. Requires the codex_hooks=true feature flag | .opencode/plugins/*.tsMore than 20 events and TypeScript or JavaScript plugins | hooks.jsonRoughly 18 events, including Tab completion | |
| Slash commands | .claude/commands/*.mdMerged into Skills, with legacy paths still supported | ~/.codex/prompts/*.mdDeprecated in favor of Skills | .opencode/commands/*.mdSupports $ARGUMENTS, $N, shell substitution, and @file | .cursor/commands/*.mdMinimal Markdown without frontmatter | |
| Spec template | No official template | No official template | No official template | No official template | No official template |
Notes
- AGENTS.md is a convention across tools. The Linux Foundation’s Agentic AI Foundation hosts it. The official agents.md site lists OpenAI Codex, OpenCode, Cursor, Aider, VS Code, Devin, JetBrains Junie, GitHub Copilot Coding Agent, and Windsurf, among others. Claude Code does not read AGENTS.md directly, but its documentation recommends importing it with
@AGENTS.mdor sharing it through a symbolic link. - None of these tools supplies an official spec template. Kiro and OpenSpec provide their own conventions. The tools’
/initcommands generate files for persistent instructions, such as CLAUDE.md or AGENTS.md. Requirements specifications are outside their scope.
Part II: Engineering and practice
4. Agent coding workflows and frameworks: Putting software engineering into context
The harness ties together documentation, coding, and software engineering.
1. Start with how the engineer thinks


2. Routine upkeep: From AGENTS.md to skills and specs


3. Managing expectations
Correct course promptly and use feedback to refine the result.

4. Review and acceptance: How do you trust code you haven’t seen?
4.1 Humans become the bottleneck


What can you do about it?


4.2 Review

4.3 Self-testing and acceptance

5. Moving up to open-source frameworks
Once you have some hands-on experience, you can adopt or take ideas from established workflow frameworks and open-source skill packs.
5.1 openspec(Fission-AI/OpenSpec)

5.2 superpowers(obra/superpowers)

5.3 mattpocock/skills(mattpocock/skills)

5.4 Side-by-side comparison

6. Unfamiliar domains: Hands-on practice and selective learning

If you want a better grasp of the work:
The domain knowledge a task requires can have layers of dependencies. Understanding A may require B, which may require C, which may require D.

One rule: Any task whose medium is text is within an LLM’s reach.
What lies outside that reach is the idea in your head: what you actually want and how clearly you’ve thought it through.
The workflow and tools in between turn that idea into something real. You can hand all of that to an LLM.
Warning: Stretch your abilities within reason. If the work goes too far beyond what you can understand, you will not be able to maintain it, iterate on it, or recover when it goes wrong.
5. Breakdowns and damage
1. Model capabilities and context degradation
1.1 Why model capabilities matter



1.2 Context degradation
A larger context window lets the model handle more complex and longer prompts, but more context isn’t always better. As token counts rise, accuracy and recall can fall. This is known as context degradation. What goes into the context matters as much as the size of the window.


2. Engineer breakdown: Taking on more than you can handle
- The project’s size and complexity outstrip your knowledge and skills. Iteration and maintenance become dependent on the agent.
- The engineer stops learning and growing and becomes a conduit between the model and real-world requirements.



3. Safety and damage: Isolate the environment
Keep important tokens, sensitive paths, and credentials out of the LLM context wherever possible. You can set up a dedicated account for the agent, such as a separate GitHub account.
3.1 Prompt injection: “Hey, Xiao Ai”
A stranger being able to wake up a Xiao Ai assistant and issue a command is a simple example of prompt injection.

3.2 Database deletion: Isolation and backups

6. My everyday workflow
