moai-foundation-context

moai-foundation-context is a skill for Claude Code from modu-ai/moai-adk. It costs 41 tokens per session (2,714 once invoked), scanned A, original, Apache-2.0.

A guide to managing context, saved session state, and token budgets in long-running or multi-agent coding workflows. Tokens are the units used to measure the text an AI model can process.

In plain words
What is it for?
Use it to manage large sessions, monitor context limits, persist state, coordinate multiple agents, or plan transitions between workflow stages.
Why use it?
It helps prevent important information from being lost as a session grows. It also supports handing work between agents and keeping the working context focused.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; mentions Claude Code.

Good fit Use it to manage large sessions, monitor context limits, persist state, coordinate multiple agents, or plan transitions between workflow stages.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/modu-ai/moai-adk/moai-foundation-context
About the project

MoAI-ADK is a Go-based harness that organizes and verifies Claude Code work across planning, implementation, synchronization, and review stages. Developers use it to structure agentic coding tasks, apply quality gates, and route work across language models, while the catalogue entries extend its workflow with skills, hooks, commands, MCP servers, instructions, and settings.

modu-ai/moai-adk · 1,204 stars · on GitHub · adk.mo.ai.kr

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add modu-ai/moai-adk --skill moai-foundation-context
Clone the repo
git clone --depth 1 https://github.com/modu-ai/moai-adk

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for moai-foundation-context

README.md
[![agentmods](https://agentmods.dev/badge/skills/modu-ai/moai-adk/moai-foundation-context/github.svg)](https://agentmods.dev/skills/modu-ai/moai-adk/moai-foundation-context)
Your own site
<a href="https://agentmods.dev/skills/modu-ai/moai-adk/moai-foundation-context"><img src="https://agentmods.dev/badge/skills/modu-ai/moai-adk/moai-foundation-context/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for moai-foundation-context

Your own site · 80×15
<a href="https://agentmods.dev/skills/modu-ai/moai-adk/moai-foundation-context"><img src="https://agentmods.dev/badge/skills/modu-ai/moai-adk/moai-foundation-context.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,714 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Prompt Injection · line 237
    Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
    Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
  • high Prompt Injection · line 251
    Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
    Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00041 $0.02714
Opus 5 $0.00020 $0.01357
Sonnet 5 $0.00008 $0.00543
Haiku 4.5 $0.00004 $0.00271

Measured 6d ago against content hash 24ee8386476b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

moai-foundation-context scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.moai/archive/skills/v3.0/moai-foundation-context/SKILL.md · 272 lines

How it starts

The opening of the file, as written. The whole thing — 272 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Quick Reference

Enterprise Context and Session Management - Unified context optimization and session state management for Claude Code with 200K token budget management, session persistence, and multi-agent handoff protocols.

Core Capabilities:

  • 200K token budget allocation and monitoring
  • Session state tracking with persistence
  • Context-aware token optimization
  • Multi-agent handoff protocols
  • Progressive disclosure and memory management
  • Session forking for parallel exploration

When to Use:

  • Session initialization and cleanup
  • Long-running workflows exceeding 10 minutes
  • Multi-agent orchestration
  • Context window approaching limits exceeding 150K tokens
  • Model switches between Haiku and Sonnet
  • Workflow phase transitions

Key Principles:

Avoid Last 20%: Performance degrades in final fifth of context window.

Aggressive Clearing: Execute /clear every 1-3 messages for SPEC workflows.

Lean Memory Files: Keep each file under 500 lines.

Disable Unused MCPs: Minimize tool definition overhead.

Quality Over Quantity: 10% relevant context beats 90% noise.


Implementation Guide

Features

  • Intelligent context window management for Claude Code sessions
  • Progressive file loading with priority-based caching
  • Token budget tracking and optimization alerts
  • Selective context preservation across /clear boundaries
  • MCP integration context persistence

When to Use

  • Managing large codebases exceeding 150K token limits
  • Optimizing token usage in long-running development sessions
  • Preserving critical context across session resets
  • Coordinating multi-agent workflows with shared context
  • Debugging context-related issues in Claude Code

Core Patterns

Pattern 1 - Progressive File Loading:

Load files by priority tiers. Tier 1 includes CLAUDE.md and config.json which are always loaded. Tier 2 includes current SPEC and implementation files. Tier 3 includes related modules and dependencies. Tier 4 includes reference documentation loaded on-demand.

Read the full file on GitHub · 272 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 272 lines · 41 tokens per session scan A 24ee8386476b

Subscribe to this mod's changes

moai-foundation-context is a skill published in the GitHub repository modu-ai/moai-adk (1,204 stars, last pushed yesterday), licensed Apache-2.0. It adds 41 tokens to every session and 2,714 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

quarter-clone

Clone the last quarter of the current conversation, discarding earlier context to reduce token usage while preserving recent work.

ykdojo/claude-code-tips · 26 tokens

half-clone

Clone the later half of the current conversation, discarding earlier context to reduce token usage while preserving recent work.

ykdojo/claude-code-tips · 26 tokens

capture-learnings

Use in the Learn phase at the end of every task, before declaring done - dispatches the learner agent to record what was learned (conventions, pitfalls, reuse points, decisions) to the cross-session store and refresh the committed memory index, then closes the phase. Runs inline on the main thread (it owns the state…

taipt1504/claudehut · 71 tokens

claudehut-init

Use once per project before starting work (or when ClaudeHut reports no codebase index) to bootstrap ClaudeHut for a Java/Spring repository - detects the stack, generates the project memory + index + path-scoped rules, and wires the always-load @import slice. Invoked as /claudehut:claudehut-init. Idempotent.

taipt1504/claudehut · 78 tokens

summer-kb-setup

Install or refresh a service-scoped Summer Framework (io.f8a.summer) knowledge base in the current consumer service's .claude/summer-kb/. Use when a service that depends on Summer needs its local KB, when onboarding a new ewallet service, when asked to "set up / install / refresh the Summer KB", or when Summer was…

taipt1504/claudehut · 107 tokens

mem0-integration

Mem0 memory layer integration for AI agents. Implement persistent, semantic memory for long-term context retention and personalization.

a5c-ai/babysitter · 27 tokens