Maximizing Codex Weekly Quota: A Complete Guide to Goal Commands and Long-Running Agent Configuration

How to use Codex Goal commands and five project settings to maximize your weekly token quota.
This guide explains how to keep Codex Agents running continuously with the Goal command to automatically consume the weekly quota after the five-hour limit. It covers five standard project settings—agents.md, context.md, active-context, state-points, and local Skills—plus key Skills like GrowMe and Engineering Decision Review to combat context forgetting and hallucination.
Introduction: Why "Max Out" the Codex Weekly Quota
Many heavy Codex users have faced this dilemma: the five-hour rolling quota runs out quickly, while the weekly billing quota remains chronically underutilized. In a recent share, a Bilibili content creator offered a complete solution—using the Goal command (the go command) to keep the Agent running continuously and automatically, so that after the five-hour quota is exhausted, it automatically switches over to consuming the weekly quota.
OpenAI Codex is a model family based on the GPT series, specially optimized for code generation and understanding scenarios. Its Agent mode is essentially an engineering implementation of a "tool-augmented LLM": the model not only generates text but can also invoke external tools such as code executors, filesystem read/write, and shell commands, forming a closed loop of "perception-decision-action." OpenAI Codex's billing system uses a tiered quota design: the short-term rolling quota (usually with a five-hour window) is used for frequent daily calls, while the weekly quota serves as a larger resource pool for heavy users. This two-tier structure is similar to the relationship between "daily traffic limits" and "total monthly traffic" in mobile data plans—when the former runs out, the system doesn't completely stop service but automatically switches to the larger reserve pool. Ultra mode is Codex's highest-performance tier, and its core feature is a multi-Agent parallel architecture: the main Agent plays the role of Orchestrator, receiving a task and decomposing it into a subtask flow in the form of a directed acyclic graph (DAG), distributing them to parallel-running sub-Agents to be processed simultaneously, thereby dramatically speeding up the execution of complex engineering tasks. The cost is that each sub-Agent requires independent context injection, and the communication of the coordination layer itself also consumes additional tokens, causing overall token consumption to grow exponentially.
According to the creator's testing, after adopting the latest Ultra mode combined with the Goal command, roughly 1 billion tokens were consumed in just one day. This magnitude far exceeds the ceiling of the five-hour quota, which is precisely what shows the weekly quota is truly being mobilized. But to make good use of this approach, the prerequisite is that you must thoroughly prepare project settings for long-running Agent operation—otherwise, the longer it runs, the more hallucinations you'll get, and it becomes counterproductive.
This article will systematically outline this methodology: the operating mechanism of the Goal command, the five standard project settings for long-running Agents, and several key Codex Skill usages.
The Goal Command: The Core Mechanism for Keeping the Agent Running Continuously
Operating Logic
The principle of the Goal command is not complicated. When you use the go command to launch a complex task (such as a project migration), as long as you no longer manually guide or intervene—that is, no longer send new commands to interrupt it—the Agent will simply keep running the way the Goal command specifies.
The design philosophy of the Goal command aligns closely with the ReAct (Reasoning + Acting) framework widely adopted in the AI Agent field. The ReAct framework requires the Agent to explicitly output a reasoning chain (Thought) before each action, then perform the concrete operation (Action), and finally observe the result (Observation), forming a loop. By persisting the final goal and re-injecting it during context compression, the Goal command essentially provides a stable "Goal Anchor" for the ReAct loop, preventing the Agent from experiencing Goal Drift after multiple rounds of reasoning.
The key point is: when the five-hour quota is used up, the Agent won't actively stop but automatically begins consuming the weekly quota to continue working. This is precisely the core logic of "maxing out the weekly quota." The creator points out that Ultra mode is especially "token-hungry" because it dispatches large numbers of sub-Agents to complete tasks in parallel.

The Unique Advantages of the Goal Command
The Goal command also has a noteworthy feature: during context compression, it re-sends the full content of the Goal command to the Agent, allowing the Agent to re-clarify "what my goal is, and what step I've reached." This effectively mitigates the problem of the Agent "forgetting its original intent" after running for a long time.
The context window of a large language model refers to the maximum length of text the model can "see" in a single inference. When a conversation or task log exceeds this limit, the system must compress or truncate the historical content, a process known as context compression. The essence of compression is replacing original details with a shorter summary, which inevitably loses some information. For a long-running Agent, this means its "memory" of the initial task goal gradually becomes blurry as run time increases—the Goal command re-injects the complete goal into the context during each compression, which is equivalent to giving the Agent a continuously refreshed "memo" to compensate for the information loss caused by compression. This is analogous to reward function design in reinforcement learning: a clear, continuously visible goal signal is key to ensuring the Agent's behavior converges.
The Five Standard Project Settings for Long-Running Agents
The creator emphasizes that before letting Codex run long-term with the Goal command, you must first set up a standard configuration for the project. He organized this into five points and open-sourced them in his own GitHub repository.
1. agents.md: Writing Preferences and Rules
agents.md is a preference file used to define repository rules, how Codex writes code, and so on. Functionally, it's equivalent to the System Prompt in LLM application development, but persisted as a file in the code repository, achieving "prompt version management." System Prompt engineering is one of the core engineering practices in current LLM application deployment: it defines the model's role, behavioral constraints, output format, and tool usage specifications. For example, you can specify: writing code is one Agent, and after finishing, spin up a sub-Agent to review the code details and accuracy.
Note that this file should not contain too much—it only carries writing rules and preferences, and you should never stuff context into it. There is a hard constraint of Token Budget behind this—the System Prompt occupies a fixed number of tokens on each inference, and an overly long rules file will significantly compress the context space available for task execution, and may trigger the model's "Lost in the Middle" effect, where the model pays significantly less attention to the middle portion of an overly long input than to the beginning and end.

2. context.md: Stable Project Context
Context should be placed separately in context.md, recording the main points the current task needs to focus on—that is, the core context of the project. It likewise should not be too long—it's recommended to keep it under 200 lines, otherwise it becomes extremely difficult to maintain. There is a technical logic behind this limit: the longer the file, the higher the token cost of re-injecting it each time, and the more likely it is to be "selectively forgotten" by the model during compression, which is counterproductive.
The two-tier memory design of context.md and active-context draws, in architectural philosophy, on Retrieval-Augmented Generation (RAG) and the principle of separating long-term and short-term memory in cognitive science. context.md plays a role similar to the "curated knowledge base" in RAG—manually filtered, high-density project knowledge that ensures the information injected each time is the most relevant core content; while active-context is more like Working Memory, storing the immediate state of the current task and dynamically updating as the task progresses. Together, they ensure both the stable transmission of long-term project knowledge and the avoidance of interference from irrelevant historical information on the current task.
The creator specifically explained the reasoning behind this: Codex's memory isn't maintained by the chat window, because the context window fills up quickly and is repeatedly compressed—after a few rounds, it can't clearly remember the original conversation. At that point it may go browse the code to "guess" the goal, but when the code repository is large enough, it won't traverse the entire repository—it will only look at the README or the first few sentences, which very easily produces hallucinations.
AI hallucination refers to the phenomenon where a large language model generates content that is inconsistent with the facts, logically contradictory, or fabricated out of thin air. Its technical root lies in the model's generation mechanism: an LLM is essentially predicting the "next most likely token" rather than performing true logical reasoning or factual retrieval. When input information is insufficient, the context is ambiguous, or the task exceeds the training distribution, the model tends to fill in gaps with content that is statistically "plausible-sounding." In long-running Agent scenarios, hallucination risk accumulates over run time: when the Agent's coverage of a large code repository is incomplete, it will "infer" the global structure based on local files; and after the context has been compressed multiple times, it may treat an incorrect summary as fact and continue proceeding. Therefore, the stable main direction of the project must be fixed manually as long-term memory.
3. active-context: Short-Term Memory
Beyond the stable main direction, the creator also designed an additional active file to record the small direction currently being pursued. This is equivalent to giving Codex a "short-term memory": the main direction is the long-term brain, while the small direction is short-term memory that is continuously updated and doesn't retain old content. When the main direction changes, he recommends opening a worktree to ensure context stability.
Git Worktree is a Git feature that allows checking out multiple branches of the same Git repository into different working directories simultaneously, without cloning multiple copies of the repository. For the long-running scenarios of an AI Agent, the value of Worktree lies in context isolation: when the main direction switches, creating a new Worktree means the Agent starts in a clean directory environment, avoiding interference from old tasks' file states, uncommitted changes, or intermediate artifacts on the new task. Different Worktrees correspond to different branches, and you can precisely restore the Agent's work state at a given stage through Git history, complementing the "human-readable snapshots" of the state-point md.
4. State-Point md: A Project Snapshot for Humans
A long-running Goal project generates a huge amount of code. The creator frankly admits, "after sleeping, I wake up and can't understand what it's doing." Although you can use set task to query the current progress, that only shows the current state and can't trace back the main ideas and task nodes from the previous ten or twenty hours.
Therefore, he requires the Agent to write a state-point every time it completes a small direction, forming "a change log and state snapshot for humans to read." This way, humans can grasp what changes were made and the pace of progress at any time, detecting in advance what the Agent has quietly changed, rather than scrambling to remedy problems after they surface. The state-point md complements the branch history of Git Worktree: the former provides a human-readable decision trail, while the latter provides machine-traceable code snapshots, together forming a complete audit chain for long-running Agent tasks.
5. Local Skill (agents skill)
The fifth point addresses local workflows. Skills can be installed either globally or for a specific project. For capabilities frequently used in the current project, or model flaws that need repeated correction, you can solidify them into local Skills for the Agent to query.
The creator also provided a codex project setting type of Skill that can automatically build the several files described above based on the existing code repository, saving the trouble of hand-writing them.
Key Skills to Use Before Building
GrowMe: Thoroughly Interrogating the Plan Before Execution
The creator emphasizes that before actually launching the Goal command build, you must first use GrowMe. Its value lies in this: some plans seem reasonable on the surface, but the hidden analytical decisions haven't been clarified. GrowMe helps you sort out the decision analysis through a questioning approach.
There's a key operation here: after GrowMe finishes running and produces the plan, you must explicitly tell the Agent in text to "run this plan with the go command," so that the complete plan truly operates in Goal command mode. The creator believes GrowMe's interrogative planning is more practical than ChatGPT's Planning Mode.

Engineering Decision Review: Forcing Repository Traversal
This is a Skill the creator now installs in all his projects. It solves a common problem with long-running Goal commands: the Agent often reads just a few files before starting to propose architecture or refactoring suggestions, with clearly insufficient repository coverage. The root of this problem is precisely the hallucination mechanism—the Agent "infers" the global structure based on local information rather than truly understanding the design intent of the entire codebase.
This Skill clarifies the repository usage scope, forcing a sub-Agent mode or a full-repository traversal approach, requiring the entire repository to be read before making architecture or refactoring changes. By expanding the information coverage, it reduces the probability of "generalizing from a partial view" hallucinations, thereby making more reasonable solution trade-offs. This is essentially a "forced RAG" strategy—before the Agent is allowed to output architecture decisions, it first completes a systematic scan of the repository through tool calls, replacing statistical inference with real global information.
Decision Advisor: Rational Decision-Making from Multiple Angles
For decisions that tend to stay at a vague stage, Decision Advisor first determines the decision background, goals, options, regional constraints, and weights, then provides feasible perspectives through economic, strategic, and other methods. The creator believes it can provide rational analysis from about 6 angles, helping to make more reliable judgments.
The Right Way to Do AI Writing
The creator also shared a writing-type Skill and offered a profound observation about AI writing.

He clearly opposes having AI generate a 10,000-word or even 100,000-word long article all at once, because the hallucinations would be very severe. The common problem with AI writing is "reaching a local optimum but not seeing the whole picture"—a particular paragraph may seem reasonable on its own, but from a broader perspective it becomes self-contradictory, and it may even make elementary mistakes within an otherwise well-written article.
This phenomenon has roots at the information-theoretic level: the attention mechanism (Self-Attention) of the Transformer architecture theoretically has global perception capabilities, but in practice, affected by factors such as positional encoding schemes, training data distribution, and attention sparsification optimizations, the model's ability to capture long-distance token-pair dependencies in extremely long text drops significantly. Recent research (such as the "Lost in the Middle" paper) experimentally proves that when key information is placed in the middle of an extremely long context, the model's utilization rate is far lower than when it's placed at the beginning or end. This means that when the model is writing the 80th paragraph, its "memory" of the 3rd paragraph is already extremely thin, making it hard to guarantee consistency. The model may maintain logical self-consistency within local paragraphs, but at the macro-structural level, argument drift, repetition, or contradictions appear.
His recommended approach is: write it one paragraph at a time. The human first writes out the ideas, then lets the AI fill in specific paragraphs, working with a Skill that can "preserve the original meaning, rhythm, tone, and style" to revise the necessary content. This paragraph-by-paragraph writing strategy essentially returns global control to the human, with the AI only responsible for local polishing, thereby avoiding the model's innate weakness in global consistency—each generation window is kept within the range the model's attention can effectively cover. Only content generated this way has production-level readability.
Summary
The complete logic of this method can be summarized as:
- Goal: Use the Goal command to keep the Agent running continuously, automatically consuming the weekly quota after the five-hour quota is exhausted;
- Prerequisite: Build stable project memory for Codex through the five settings of agents.md, context.md, active-context, state-points, and local Skills;
- Process: First use GrowMe to interrogate and clarify the plan, then explicitly hand it over to the Goal command for execution, and use Engineering Decision Review to prevent the Agent from drawing conclusions after reading just a few files.
This setup essentially fights against the two great enemies of long-running Agents—context forgetting and hallucination. Context forgetting stems from information loss due to the compression mechanism, while hallucination stems from the model's inherent flaw of inferring the global from local information; meanwhile, context.md's streamlined design, the Goal command's goal re-injection (Goal Anchor), Worktree's environment isolation, and Engineering Decision Review's forced traversal each address these from different angles. The combination of these four mechanisms happens to cover four dimensions of the ReAct loop: the reasoning layer (goal anchor), the memory layer (streamlined context), the execution layer (environment isolation), and the perception layer (global information coverage). For beginners, it provides a reusable standard starting point; for heavy users, it's the practical path to truly maximizing the value of the weekly quota. The creator says he will maintain this open-source repository long-term and expand it beyond engineering to "life decision-making" scenarios.
Key Takeaways
Related articles

Pinery Prose: Redefining the AI Book-Writing Experience with Diff Review
Pinery Prose is a Mac AI book-writing assistant using code diff review mechanics, letting authors accept or reject each AI edit. Supports Markdown, ePub/PDF export, and covers the full self-publishing workflow.

How Developer Productivity Startups Boost Their Own Efficiency: Practicing What You Preach
How developer productivity startups practice what they preach—from automated toolchains and DORA metrics to engineering culture that shortens feedback loops and reduces cognitive load.

Laxis Review: Bot-Free Meeting Notes & Real-Time Translation AI Tool
In-depth review of Laxis AI meeting tool: bot-free recording, 100+ language real-time translation, voice dictation 4x faster than typing. Features, competitors & value analysis.