ai step when executed by Codemod’s Rig-based harness.
The workflow contract does not change. Keep using the same
ai.* fields documented in Workflow Reference.What the harness provides
- Rig-based agent loop for
aisteps. - Multi-provider execution with protocol-specific clients.
- Built-in tool server wiring for Codemod CLI tools.
- Parent coding-agent handoff mode.
- Context compaction with bounded retries.
- Structured logs for long-running steps and compaction events.
Supported LLM protocols
The harness supports:openaianthropicgoogle_aiazure_openai
Built-in tools
Default enabled tools:bashstr_replace_based_edit_toolglobsequentialthinkingtask_donejson_edit_toolckg_tool
mcp_tool
Parent-agent handoff mode
Before running Rig, Codemod checks whether it is executing under a known coding-agent parent context. Recognized agent families include:codexclaude-codeaidercursorwindsurfgooseopencodeopenclaw
detected, the step emits:
[AI INSTRUCTIONS]- prompt/system content
[/AI INSTRUCTIONS]
uncertain or not_detected, normal Rig execution continues.
Memory and context management
The harness controls context growth with a hybrid strategy:- Proactive guard:
- Estimates prompt + history size before each completion turn.
- Triggers compaction when the soft budget is exceeded.
- Reactive guard:
- Detects provider context-limit style failures.
- Triggers compaction and retries.
- Compaction pipeline:
- Deterministic pruning of older turns while preserving anchors/recent history.
- Hierarchical summarization of archived context.
- Memory packet rebuild of history.
- Bounded retries:
- Maximum compaction attempts:
5. - If still oversized, returns explicit memory exhaustion error.
Semantic retrieval behavior
When embeddings are available for the selected provider path, the harness builds an in-memory vector index and injects retrieved dynamic context into agent calls.- Enabled path:
openai,google_ai,azure_openai. - Fallback path:
anthropicruns without dynamic vector context injection.
Token behavior
The harness does not force an explicitmax_tokens request. Output token limits are left to provider/model defaults.
Context-window handling is managed separately through compaction and bounded retry behavior.
Observability
Engine logs include:- handoff detection decision (
handoffvsrig) - periodic progress (
AI step still running ...) - compaction events (
AI memory compaction applied ...) - explicit memory exhaustion diagnostics when retries are exhausted