moai-foundation-core
Skill1.2k starsChanged 3 months agoApache-2.0View on GitHub
Provides MoAI-ADK foundational principles including TRUST 5 quality framework, SPEC-First DDD methodology, delegation patterns, progressive disclosure, agent catalog reference, and token budget management (absorbed from moai-foundation-context). Use when referencing TRUST 5 gates, SPEC workflow, or context window optimization.
1 other project uses a version of this, 1 of them edited.
Trending
Quiet since September.thin dataabout the whole repository
Most recently taken up by
- modu-ai/cc-pluginsedited, first seen Feb 11, 2026
Who's talking about modu-ai/moai-adk
- Ven0m0/claude-config“Add a structured external integration plan to the root TODO backlog”GitHub · Mar 18, 2026 · 4 reactions
- Ven0m0/claude-config“TODO list”GitHub · Jan 31, 2026 · 1 reactions
- sudosubin/agents.nix“agent-skills.github.modu-ai.moai-adk: init at 3.1.2”GitHub · Sep 30, 2026
- anthropics/claude-code“Worktree-isolation Bash check folds command substitutions in quoted-delimiter heredoc bodies but refuses …”GitHub · Sep 7, 2026
- bjw202/minidiscord“docs(t41): moai gate 종료 코드 합류 — upstream 이슈 문안 (제출 안 함)”GitHub · Sep 6, 2026
The biggest 5 of 13 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 13
Talked about on GitHub (13 times).
On GitHub · 13
- Mar 18, 2026Add a structured external integration plan to the root TODO backlog — Ven0m0/claude-config4 reactions · 4 comments
- Jan 31, 2026TODO list — Ven0m0/claude-config1 reaction · 18 comments
- Sep 30, 2026agent-skills.github.modu-ai.moai-adk: init at 3.1.2 — sudosubin/agents.nix0 reactions
- Sep 7, 2026Worktree-isolation Bash check folds command substitutions in quoted-delimiter heredoc bodies but refuses braces there, though such bodies cannot expand — anthropics/claude-code0 reactions
- Sep 6, 2026docs(t41): moai gate 종료 코드 합류 — upstream 이슈 문안 (제출 안 함) — bjw202/minidiscord0 reactions
8 more on GitHub
- Jul 23, 2026Hands-on eval: promote MoAI-ADK to core tier — cameronsjo/spec-compare0 reactions
- Apr 22, 2026Add MoAI-ADK to Collections & Libraries — travisvn/awesome-claude-skills0 reactions
- Apr 22, 2026Add MoAI-ADK to Meta & Orchestration category — VoltAgent/awesome-claude-code-subagents0 reactions
- Apr 22, 2026Add MoAI-ADK — SPEC-first Agentic Development Kit — jqueryscript/awesome-claude-code0 reactions
- Apr 22, 2026Add MoAI-ADK — SPEC-first AI-assisted coding framework — wsxiaoys/awesome-ai-coding0 reactions
- Apr 22, 2026Add MoAI-ADK — SPEC-first Agentic Development Kit for Claude Code — e2b-dev/awesome-ai-agents0 reactions
- Nov 19, 2025Issue #1: Estructura base del proyecto .NET 9 — mjcuadrado/mjcuadrado-net-sdk0 reactions
- Nov 13, 2025fix: resolve conflitos Git + remove hooks SYNC bloqueantes (Windows f… — PedroGiudice/lex-vector0 reactions
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- modu-ai/cc-plugins★ 6872% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- hns-lsel-applierSkill
- hns-lsel-curatorSkill
- hns-moaiadk-best-practicesSkill
- hns-moaiadk-dev-referenceSkill
- hns-moaiadk-patternsSkill
- hns-oss-docs-i18n-rulesSkill
- hns-oss-docs-readme-syncSkill
- hns-oss-docs-structure-mapSkill
- hns-oss-docs-verifySkill
- hns-workflow-ci-loopSkill
- moai-domain-backendSkill
- moai-domain-databaseSkill
- moai-domain-design-dnaSkill
- moai-domain-frontendSkill
- moai-domain-html-reportSkill
- moai-domain-humanizeSkill
- moai-domain-svg-infographicSkill
- moai-foundation-ccSkill
- moai-foundation-qualitySkill
- moai-foundation-thinkingSkill
- moai-harness-learnerSkill
- moai-kanban-foremanSkill
- moai-meta-harnessSkill
- moai-ref-api-patternsSkill
- moai-ref-cross-model-auditSkill
- moai-ref-git-workflowSkill
- moai-ref-llm-securitySkill
- moai-ref-owasp-checklistSkill
- moai-ref-react-patternsSkill
- moai-ref-secopsSkill
- moai-ref-seoSkill
- moai-ref-supply-chainSkill
- moai-ref-testing-pyramidSkill
- moai-ref-ui-polishSkill
- moaiSkill
- moai-workflow-dddSkill
- moai-workflow-docs-claim-checkSkill
- moai-workflow-loopSkill
- moai-workflow-projectSkill
- moai-workflow-specSkill
- moai-workflow-tddSkill
- moai-workflow-testingSkill
- moai-workflow-worktreeSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 318
After /moai plan completion (before /moai run)
- Distinctive: line 319
When context exceeds 150,000 tokens (Sonnet/standard)
- Distinctive: line 320
Before major phase transitions
- Distinctive: line 322
Never use /clear when: In the middle of an agent task, when session state has not been persisted.
- Very specific: line 326
Before /clear, persist in-flight state to .moai/specs/<SPEC-ID>/progress.md:
- Distinctive: line 341
When delegating to a sub-agent near context ceiling:
- Distinctive: line 345
If parent context > 120,000 tokens after return, save and /clear
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MoAI Foundation Core
Foundational principles and architectural patterns that power MoAI-ADK's AI-driven development workflow.
Core Philosophy: Quality-first, domain-driven, modular, and efficient AI development through proven patterns and automated workflows.
Quick Reference
What is MoAI Foundation Core?
Six essential principles that ensure quality, efficiency, and scalability in AI-powered development:
- TRUST 5 Framework - Quality gate system (Tested, Readable, Unified, Secured, Trackable)
- SPEC-First DDD - Specification-driven domain-driven development workflow
- Delegation Patterns - Task orchestration via specialized agents (never direct execution)
- Token Optimization - 200K budget management and context efficiency
- Progressive Disclosure - Three-tier knowledge delivery (Quick, Implementation, Advanced)
- Modular System - File splitting and reference architecture for scalability
Quick Access:
- Quality standards in modules/trust-5-framework.md
- Development workflow in modules/spec-first-ddd.md
- Agent coordination in modules/delegation-patterns.md
- Budget management in modules/token-optimization.md
- Content structure in modules/progressive-disclosure.md
- File organization in modules/modular-system.md
- Agent catalog in modules/agents-reference.md
- Command reference in modules/commands-reference.md
- Security and constraints in modules/execution-rules.md
Use Cases:
- New agent creation with quality standards
- New skill development with structural guidelines
- Complex workflow orchestration
- Token budget planning and optimization
- Documentation architecture design
- Quality gate configuration
Implementation Guide
1. TRUST 5 Framework - Quality Assurance System
Purpose: Automated quality gates ensuring code quality, security, and maintainability.
Five Pillars:
Tested Pillar: Maintain comprehensive test coverage with characterization tests ensuring behavior preservation. Execute the project's test runner with coverage (e.g. go test -cover, pytest --cov, cargo test, npm test -- --coverage). Block merge and generate missing tests on failure. Characterization tests capture current behavior for legacy code, while specification tests validate domain requirements for new code. High coverage ensures code reliability and reduces production defects, and preserves behavior during refactoring.
Readable Pillar: Use clear and descriptive naming conventions. Run the project's linter (e.g. golangci-lint, ruff, eslint, clippy). Issue warning and suggest refactoring improvements on failure. Clear naming improves code comprehension, team collaboration, and maintenance velocity.
Unified Pillar: Apply consistent formatting and import patterns. Run the project's formatter (e.g. gofmt, black, prettier, rustfmt). Auto-format code or issue warning on failure. Consistency eliminates style debates and merge conflicts and improves readability.
Secured Pillar: Comply with OWASP security standards. Surface security findings via the appropriate agent or reference skill (e.g. spawn a per-spawn general-purpose agent with security instructions, or load the moai-ref-owasp-checklist / moai-ref-llm-security reference). Block merge and require security review on failure. Security vulnerabilities create critical business and legal risks.
Trackable Pillar: Write clear and structured commit messages. Match Git commit message regex patterns (Conventional Commits). Suggest proper commit message format on failure. Clear history enables debugging, auditing, and collaboration.
Integration Points: Pre-commit hooks for automated validation, CI/CD pipelines for quality gate enforcement, Agent workflows for TRUST 5 validation (moai-foundation-quality orchestration), Documentation for quality metrics.
Detailed Reference: modules/trust-5-framework.md
2. SPEC-First DDD - Development Workflow
Purpose: Specification-driven development ensuring clear requirements before implementation.
Three-Phase Workflow:
Phase 1 SPEC (/moai plan): workflow-spec generates GEARS format (primary; EARS retained as 6-month backward-compat legacy reference for the 88 pre-v3 SPECs). Output is .moai/specs/SPEC-XXX/spec.md. Execute /clear to save 45-50K tokens.
Phase 2 DDD (/moai run): ANALYZE for requirements, PRESERVE for existing behavior, IMPROVE for enhancement. Validate with at least 85% coverage.
Phase 3 Docs (/moai sync): API documentation, architecture diagrams, project reports.
GEARS Format (current notation): Five patterns — Ubiquitous "The <subject> shall <behavior>" for system-wide always active requirements; Event-driven "When <event> the <subject> shall <behavior>" for trigger-response requirements; State-driven "While <state> the <subject> shall <behavior>" for conditional behavior; Where (capability gate) "Where <capability or feature flag>, the <subject> shall <behavior>" for capability-conditioned behavior; Event-detected (replaces the deprecated conditional modality) "When <undesired-condition-detected>, the <subject> shall <response>" for failure-mode handling. Unified compound clause: [Where ...][While ...][When ...] The <subject> shall <behavior> — any subset of the three modifiers may chain. The <subject> is generalized — any noun (system, component, service, agent, function, artifact). See the canonical authoring guide at .claude/skills/moai-workflow-spec/SKILL.md § "GEARS Format".
EARS Format (legacy reference, 6-month backward-compat — expires 2026-11-22): Five patterns Ubiquitous / Event-driven (WHEN/THEN) / State-driven (WHILE) / Unwanted (SHALL NOT) / Optional (WHERE possible). The 88 pre-v3 SPECs continue to use EARS; the lint engine emits a LegacyEARSKeyword warning on residual deprecated conditional modality in NEW SPECs (warning non-strict, error under moai spec lint --strict). For NEW SPECs, use GEARS. See modules/spec-ears-format.md (legacy reference, deprecated — see GEARS Format guide).
Token Budget: SPEC takes 30K, DDD takes 180K, Docs takes 40K, Total is 250K.
Key Practice: Execute /clear after Phase 1 to initialize context.
Detailed Reference: modules/spec-first-ddd.md
3. Delegation Patterns - Agent Orchestration
Purpose: Task delegation to specialized agents, avoiding direct execution.
Core Principle: MoAI must delegate all work through Agent() to specialized agents. Direct execution bypasses specialization, quality gates, and token optimization. Proper delegation improves task success rate by 40 percent and enables parallel execution.
Delegation Syntax: MoAI delegates via natural language — "Use the {agent} subagent to {task}" — carrying full context, constraints, and rationale. The orchestrator never passes a subagent_type code literal; it spawns Agent() (or Agent(general-purpose) for domain work) with a prose prompt.
Three Patterns:
Sequential for dependencies: Use the manager-spec subagent to author the SPEC, then the manager-develop subagent to implement it with the SPEC as context.
Parallel for independent work: Spawn multiple Agent(general-purpose) teammates in one turn — e.g. one with backend instructions and one with frontend instructions — when the work is independent.
Conditional for analysis-based: Use the Explore subagent for read-only diagnosis, then route the result to the appropriate retained agent (manager-develop for fixes, sync-auditor for quality scoring) based on the findings.
Agent Selection: Simple tasks with 1 file use 1-2 agents sequential. Medium tasks with 3-5 files use 2-3 agents sequential. Complex tasks with 10+ files use 5+ agents mixed. Domain-specific work (backend / frontend / security / performance / refactoring) is handled in run-phase by manager-develop, or by a per-spawn Agent(general-purpose) with a domain whitelist per .claude/rules/moai/workflow/archived-agent-rejection.md.
Detailed Reference: modules/delegation-patterns.md
4. Token Optimization - Budget Management
Purpose: Efficient 200K token budget through strategic context management.
Budget Allocation:
SPEC Phase takes 30K tokens. Strategy is to load requirements only and execute /clear after completion. Specification phase requires minimal context for requirement analysis. Saves 45-50K tokens for implementation phase.
DDD Phase takes 180K tokens. Strategy is selective file loading, load only implementation-relevant files. Implementation requires deep context but not full codebase. Enables 70 percent larger implementations within budget.
Docs Phase takes 40K tokens. Strategy is result caching and template reuse. Documentation builds on completed work artifacts. Reduces redundant file reads by 60 percent.
Total Budget is 250K tokens across all phases. Phase separation with context reset between phases provides clean context boundaries and prevents token bloat. Enables 2-3x larger projects within same budget.
Token Saving Strategies:
Phase Separation: Execute /clear between phases, after /moai plan to save 45-50K, when context exceeds 150K, after 50+ messages.
Selective Loading: Load only necessary files.
Context Optimization: Target 20-30K tokens.
Model Selection: Sonnet for quality, Haiku for speed and cost with 70% cheaper rates for 60-70% total savings.
Detailed Reference: modules/token-optimization.md
5. Progressive Disclosure - Content Architecture
Purpose: Three-tier knowledge delivery balancing value with depth.
Three Levels:
Quick Reference Level: 30 seconds time investment, core principles and essential concepts, approximately 1,000 tokens. Rapid value delivery for time-constrained users. Users gain 80 percent understanding in 5 percent of time.
Implementation Level: 5 minutes time investment, workflows, practical examples, integration patterns, approximately 3,000 tokens. Bridges concept to execution with actionable guidance. Enables immediate productive work without deep expertise.
Advanced Level: 10+ minutes time investment, deep technical dives, edge cases, optimization techniques, approximately 5,000 tokens. Provides mastery-level knowledge for complex scenarios. Reduces escalations by 70 percent through comprehensive coverage.
SKILL.md Structure (maximum 500 lines): Quick Reference section, Implementation Guide section, Advanced Patterns section, Works Well With section.
Module Architecture: SKILL.md as entry point with cross-references, modules directory for deep dives with unlimited size, examples.md for working samples, reference.md for external links.
File Splitting when exceeding 500 lines: SKILL.md contains Quick at 80-120 lines, Implementation at 180-250 lines, Advanced at 80-140 lines, References at 10-20 lines. Overflow content goes to modules/topic.md.
Detailed Reference: modules/progressive-disclosure.md
6. Modular System - File Organization
Purpose: Scalable file structure enabling unlimited content.
Standard Structure: Create .claude/skills/skill-name/ directory containing SKILL.md as core file under 500 lines, modules directory for extended content with unlimited size including patterns.md, examples.md for working samples, reference.md for external links, scripts directory for utilities (optional), templates directory (optional).
File Principles: SKILL.md stays under 500 lines with progressive disclosure and cross-references. modules directory is topic-focused with no limits and self-contained content. examples.md is copy-paste ready with comments. reference.md contains API docs and resources.
Cross-Reference Syntax: Reference modules as Details in modules/patterns.md, reference examples as Examples in examples.md#auth, reference external docs as External in reference.md#api.
Discovery Flow: SKILL.md to Topic to modules/topic.md to Deep dive.
Detailed Reference: modules/modular-system.md
Advanced Implementation
Advanced patterns including cross-module integration, quality validation, and error handling are available in the detailed module references.
Key Advanced Topics:
- Cross-Module Integration: Combining TRUST 5 + SPEC-First DDD
- Token-Optimized Delegation: Parallel execution with context reset
- Progressive Agent Workflows: Escalation patterns
- Quality Validation: Pre/Post execution validation
- Error Handling: Delegation failure recovery
Detailed Reference: references/examples.md for working code samples
Works Well With
Agents: builder-harness for generating agents/skills/harnesses with foundation principles, manager-spec for plan-phase authoring, manager-develop for run-phase implementation, manager-docs for sync-phase documentation, sync-auditor for independent TRUST 5 quality scoring, super-advisor for on-demand high-reasoning consultation.
Skills: moai-foundation-cc for Claude Code authoring (skills, agents, plugins, hooks), moai-workflow-spec for GEARS format specification (current; EARS retained as legacy reference), moai-workflow-ddd for ANALYZE-PRESERVE-IMPROVE execution, moai-workflow-tdd for RED-GREEN-REFACTOR cycles, moai-foundation-quality for TRUST 5 validation orchestration, moai-foundation-thinking for strategic reasoning and Adaptive Thinking via the ultrathink keyword.
Tools: AskUserQuestion for direct user interaction and clarification needs.
Commands: /moai plan for SPEC-First Phase 1, /moai run for DDD Phase 2, /moai sync for Documentation Phase 3, /moai feedback for continuous improvement, /clear for token management.
Foundation Modules (Extended Documentation): modules/agents-reference.md for the 11-agent retained catalog (10 MoAI-custom + 1 Anthropic built-in Explore), modules/commands-reference.md for 6 core commands workflow, modules/execution-rules.md for security, Git strategy, and compliance. For migration of references to the 12 archived agents (manager-strategy, manager-quality, manager-brain, manager-project, claude-code-guide, researcher, and the 6 expert-* agents), see .claude/rules/moai/workflow/archived-agent-rejection.md.
Quick Decision Guide
New Agent: Primary principle is TRUST 5 and Delegation. Supporting principles are Token Optimization and Modular.
New Skill: Primary principle is Progressive and Modular. Supporting principles are TRUST 5 and Token Optimization.
Workflow: Primary principle is Delegation Patterns. Supporting principles are SPEC-First and Token Optimization.
Quality: Primary principle is TRUST 5 Framework. Supporting principle is SPEC-First DDD.
Budget: Primary principle is Token Optimization. Supporting principles are Progressive and Modular.
Docs: Primary principle is Progressive and Modular. Supporting principle is Token Optimization.
Module Deep Dives: modules/trust-5-framework.md, modules/spec-first-ddd.md, modules/delegation-patterns.md, modules/token-optimization.md, modules/progressive-disclosure.md, modules/modular-system.md, modules/agents-reference.md, modules/commands-reference.md, modules/execution-rules.md.
Full Examples: references/examples.md External Resources: references/reference.md
<!-- moai:evolvable-start id="rationalizations" -->Common Rationalizations
| Rationalization | Reality |
| "TRUST 5 is a guideline, not a gate" | TRUST 5 is a HARD quality gate. All five dimensions must pass before completion. |
| "I can skip the SPEC for this small change" | Every change without a SPEC is untracked. SPEC-less changes accumulate into unmanageable technical debt. |
| "Delegation to an agent is overhead for simple tasks" | MoAI is an orchestrator, not an implementer. Skipping delegation bypasses domain expertise and quality checks. |
| "I will skip the quality gate, the code is clearly correct" | Clearly correct code still needs evidence. Tests and linting are mechanisms; confidence is not. |
| "Progressive disclosure is not important for this project" | Even small projects benefit from token-efficient skill loading. Disclosure is about context budget, not project size. |
<!-- moai:evolvable-end --><!-- moai:evolvable-start id="red-flags" -->Red Flags
- MoAI executing implementation code directly instead of delegating to an agent
- TRUST 5 dimensions partially checked (only Tested and Readable, ignoring Secured)
- SPEC document exists but has no acceptance criteria
- Agent selected without consulting the selection decision tree
- Quality gate skipped with "will check later" comment
<!-- moai:evolvable-end --><!-- moai:evolvable-start id="verification" -->Verification
- All five TRUST 5 dimensions addressed (Tested, Readable, Unified, Secured, Trackable)
- Agent selection documented with rationale matching the decision tree
- SPEC document has acceptance criteria with observable evidence requirements
- Delegation chain traceable: MoAI -> agent -> execution
- Progressive disclosure levels configured in skill frontmatter
<!-- moai:evolvable-end -->Token Budget (absorbed from moai-foundation-context)
Context window optimization, /clear strategy, session state persistence, and multi-agent handoff patterns.
Context Window Targets
See .claude/rules/moai/workflow/context-window-management.md § Context Window Targets for the authoritative per-model-class /clear threshold table (1M/GLM = 50%, 200K/256K = 90%). Do not restate thresholds here (SSOT).
Phase Token Allocation
| Phase | Budget | Strategy |
| /moai plan | 30,000 | Load requirements only, /clear after completion |
| /moai run | 180,000 | Selective file loading, on-demand skill loading |
| /moai sync | 40,000 | Result caching, reduced redundant reads |
/clear Strategy
Mandatory /clear points:
- After
/moai plancompletion (before/moai run) - When context exceeds 150,000 tokens (Sonnet/standard)
- Before major phase transitions
Never use /clear when: In the middle of an agent task, when session state has not been persisted.
Session State Persistence
Before /clear, persist in-flight state to .moai/specs/<SPEC-ID>/progress.md:
- Current task status (completed, in-progress, blocked)
- File modification summary
- Next action required
- Resume message for paste-back after /clear
Resume message format:
Wave <N> 이어서 진행. SPEC-<ID>부터 <approach>.
progress.md: .moai/specs/<ID>/progress.md
다음 단계: <command>.Multi-Agent Handoff
When delegating to a sub-agent near context ceiling:
- Summarize findings in progress.md before Agent() call
- Pass only necessary context in spawn prompt (avoid full file dumps)
- Sub-agent result contributes to parent context on return — factor this in
- If parent context > 120,000 tokens after return, save and /clear
Full optimization patterns: modules/token-optimization.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

