moai-foundation-context

Manage token budgets and persist session state for Claude Code workflows.

1.2k|214|Updated Sep 16, 2025
One-click install
npx skills add https://github.com/modu-ai/moai-adk --skill moai-foundation-context
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-foundation-context
Source: https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-foundation-context
Command: npx skills add https://github.com/modu-ai/moai-adk --skill moai-foundation-context

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps Claude Code manage large contexts, optimize a fixed token budget, persist session state, and coordinate multi-agent workflows to prevent context overflow and improve reliability.

Core Features & Use Cases

  • Token budget awareness: Allocate and monitor a 200K token context window with smart reallocation.
  • Session persistence: Maintain session state across interruptions for seamless resumption.
  • Context optimization: Progressive loading and memory management to reduce token waste.
  • Multi-agent handoffs: Handoff and forking protocols to enable parallel exploration without losing state.
  • Memory discipline: Clear guidance on memory files and disciplined context retention.

Example: When working on a long-running SPEC, initialize a 200K budget, persist session state, and enable handoffs between agents to explore multiple design options without blowing the token window.

Quick Start

Activate moai-foundation-context with a 200K token budget and persistent session, then begin a long-running SPEC exploration.

Frequently Asked Questions about moai-foundation-context

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage token budgets in Claude Code for long-running workflows?

Token budget management tracks your 200K context window allocation, monitors token consumption in real time, and reallocates remaining capacity as your session progresses. Set an initial budget, enable tracking, and receive alerts when approaching limits to prevent context overflow during extended development tasks.

What's the best way to preserve session state across Claude Code interruptions?

Session persistence saves your current state—variables, file history, and agent context—so you resume exactly where you left off after interruptions or resets. Enable session snapshotting to restore full context without manual reconstruction, maintaining continuity across multiple work sessions.

How do multi-agent handoffs work in Claude Code without losing context?

Handoff protocols coordinate state transfer between agents by packaging current context, session snapshots, and token budgets into a structured format that the receiving agent ingests immediately. This enables parallel exploration and agent forking while preserving all prior work and memory discipline.

Can I optimize context windows to reduce token waste in long SPECs?

Context optimization applies progressive loading and memory discipline to discard unnecessary information early, compress verbose state into dense summaries, and reload only active dependencies. This reduces wasted tokens on stale context while keeping critical session data intact for the full workflow duration.

Do I need MCP context continuity for multi-agent coordination in Claude Code?

MCP context continuity enables robust handoff protocols between agents and ensures session state persists across model transitions and agent forks. It's required for coordinated multi-agent workflows; without it, agents cannot reliably share memory or coordinate on shared development tasks.

What happens when my Claude Code context window reaches capacity?

Threshold-based compression triggers automatically when context approaches the 200K limit, compacting verbose sections and clearing inactive memory to free tokens. If compression insufficient, /clear commands selectively purge non-essential session data while preserving active state and task progress.