How should you combine goal and display using subagent for codex? along with their technical principles and some typical scenarios. goal is responsible for “what exactly is to be achieved in this round of long-term tasks” and subagent is responsible for “which subtasks can be taken out in parallel”. The best combination is: set goal first, and then explicitly authorize the main agent to use subagent to push in parallel. Technical principle goal is the task state in the main thread and will not execute the code itself. Its value is to keep Codex aligned during long tasks and avoid deviations after multiple rounds of dialogue. It is suitable for "fix X", "complete the migration of Y", "implement and validate Z". The subagent is an independent agent derived from the current context. It can read code, analyze problems, and even modify files in a separate workspace. The main agent is responsible for unpacking tasks, assigning boundaries, waiting for results, and merging judgments. subagent does not share the same brain state and collaborates in real time. It receives a clear task description, executes it independently, and then returns the conclusions or changes to the main agent. The recommended modes are: Goal: Define final completion criteria Main agent: Master control, Disassembly, Critical path, Integration, Validation SubAgent A/B/C: Parallel exploration or handling of non-conflicting subtasks When to use goal? Suitable for tasks that span multiple rounds, are easy to interrupt, and require continuous tracking: - "Fix the Codex bridge to be stable and usable" - "Refactor the authentication module of this project and make up the test" - "Organize the skills system without destroying fireworks-KNOWLEDGE" - "Do a complete performance optimization until the benchmark crosses the line" Scenario where goal is less needed: - "Explain this function" - "Change the color of a button" - "Run a test" - "Check the log" When is SubAgent explicitly used? Suitable for tasks with parallel, clear boundaries, and combinable results: - Multi-directional troubleshooting: one agent checks the log, one agent checks the code, and one agent checks the configuration. - Large codebase exploration: an agent looks at routing, an agent looks at the database layer, and an agent looks at front-end state management. - Independent module implementation: A changes the API layer, B changes the UI, and C makes up the test, provided that the scope of the written file does not conflict. - Review and verification: main agent implementation, subagent parallel code review or test risk check. - Documentation/migration class tasks: an agent statistics the status quo, an agent designs the target structure, and an agent generates migration scripts. Scenarios that are not suitable for subagent: - Small single point modification, opening the agent is slow. - Strongly coupled code that requires frequent sharing of context. - The first step on the critical path, such as having to read a core configuration before proceeding. - The same batch of documents will be changed, which is easy to conflict. You can order a simple long-term task like this: Create a goal: Fix the codex bridge. The completion criteria is that the codex can receive Chinese replies, and the long task has progress. Anti-large code base troubleshooting: Create a goal for this task, and use 3 subagents:
- A lookup log and running status
- One lookup Codex provider execution link
- A check Feishu/Lark sending and card link main agent is responsible for the integration scheme and final modification. Implementation task: create goal: achieve account multi-tenant isolation. Subagents are allowed. Please ask the main agent to split the file boundaries first, then divide the API, database migration, and front-end settings pages to different subagents, and finally run the test uniformly. Review Task: Create Goal: Complete the risk review for this PR. Use subagent parallelism: one to look at security issues, one to look at performance issues, and one to look at test coverage. The main agent is aggregated into a review sorted by severity. Recommended default usage for small tasks: no goal, no subagent. Medium task: Don't use goal, but say “check in parallel with subagent if necessary”. Big Tasks/Cross-Day Tasks: Create a goal before authorizing a subagent. The most useful one sentence template is: Create a goal for this task. You can use subagent parallelism, but the main agent is responsible for splitting, integration, and final validation. If you want to be more radical: create a goal for this task and proactively use subagent for parallel exploration and validation. The responsibilities and writing scope of each subagent should be clear, and do not change each other's documents in the same batch.
