English translation
2 Goal Manager: Pin the Agent's Main Objective Outside the Model
Many agents fail not because the model cannot reason, but because the goal is not stored clearly.
If the main objective only exists somewhere inside a long conversation, the agent has to rediscover it again and again. After enough tool calls, the latest detail can become louder than the original task.
A Goal Manager solves this by extracting the main objective into an independent object.
1. The Goal Is Not the Chat History
A conversation may contain:
- the user's original request
- follow-up corrections
- search results
- tool errors
- half-finished drafts
- temporary experiments
The goal should be cleaner than that.
For example, the user might say:
Help me research Gemma and write a public article with images.
The Goal Manager can store:
{
"objective": "Create a publish-ready article about Gemma for a general AI audience.",
"deliverables": ["article draft", "image suggestions", "final title"],
"constraints": ["Chinese public-account style", "avoid unsupported claims"],
"done_when": ["article is complete", "sections are coherent", "images are planned"]
}
This object is small, explicit, and reusable.
2. What a Good Goal Contract Contains
A useful goal contract usually contains five parts.
Objective
What should be accomplished?
The objective should be concrete enough that the system can tell whether the agent is still on track.
Deliverables
What must be produced?
Examples:
- Markdown article
- Word document
- deployment report
- benchmark table
- set of generated images
Constraints
What rules must be respected?
Examples:
- use official sources first
- do not expose secrets
- keep the existing page layout
- preserve image paths
Done Criteria
When is the task finished?
The agent needs a finish line. Without one, it may keep searching, rewriting, or expanding forever.
Risk Boundaries
What must not be touched?
For coding agents, this is especially important. A goal contract can say:
- do not modify authentication logic
- do not touch production credentials
- do not overwrite unrelated local changes
3. Inject the Goal on Every Call
The simplest Goal Manager loop is:
Goal
+
Current State
+
Current Task
+
User Message
This means the model is not expected to reconstruct the mission from memory. The system reminds it every time.
For long tasks, this matters more than prompt length. A short, stable goal repeated at the right moment is often better than a massive prompt that is never refreshed.
4. Goals Can Change, But Only Explicitly
A good harness does not freeze the user forever. The user can change the goal.
But the change should be explicit:
{
"revision": 2,
"changed_by": "user",
"old_goal": "Write a research article",
"new_goal": "Write a tutorial series",
"reason": "The topic is better explained step by step"
}
This avoids silent goal drift.
The agent should not quietly turn "compare two papers" into "browse interesting papers." It should ask or record the revision.
5. Practice: Write an Eight-Line Goal Contract
Take one real agent task and write:
{
"objective": "",
"deliverables": [],
"audience": "",
"constraints": [],
"done_when": [],
"must_not_do": [],
"current_priority": "",
"revision": 1
}
If the goal contract feels hard to write, the task is probably not clear enough yet.
6. Lesson Summary
The Goal Manager is the anchor of a practical agent harness.
It stores the main objective outside the transcript, injects it into each reasoning cycle, and records goal changes explicitly.
Without a Goal Manager, a long-running agent is always at risk of following the newest detail instead of the real mission.
Continue