nirvana context engineering
Squad de engenharia de contexto para agentes de IA: elicitação de requisitos, análise do projeto, design de arquitetura de contexto, geração de artefatos (CLAUDE.md, AGENTS.md, rules, configs de memória) e otimização com validação de qualidade. Pipeline de 5 fases que aplica as 5 abordagens de context engineering (RAG, ACE, Hierarchical Layering, GCC, Structured Files).
🧠 nirvana-context-engineering
Context engineering squad for AI agents — a 5-phase pipeline that transforms raw requirements into optimized context artifacts:
CLAUDE.md, contextual rules,AGENTS.md, memory configurations, and prompt templates.
📋 Table of Contents
- Overview
- Installation
- Pipeline
- Agents
- Tasks
- Workflows
- Context Engineering Approaches
- Best Practices 2026
- Generated Artifacts
- Usage
- Configuration
- Directory Structure
- Troubleshooting
- Contributing
- License
🔭 Overview
The nirvana-context-engineering squad addresses a critical problem in AI-agent-driven development: poorly structured context destroys output quality and inflates costs. Agents receiving generic, bloated, or disorganized context make poor decisions, ignore project constraints, and repeat already-documented mistakes.
This squad applies state-of-the-art Context Engineering practices to ensure each agent receives exactly the right context — no more, no less.
Who is this squad for?
- Teams adopting AIOS who need high-quality initial context setup
- Legacy projects being onboarded to agent-driven development
- Teams noticing progressive quality degradation in AI responses
- Engineers who want to standardize context management across multiple projects
CLAUDE.md can reduce tokens per session by 40–60% while improving response coherence.
⚡ Installation
npx squads add gutomec/squads-sh/nirvana-context-engineeringVerify installation:
squads list | grep nirvana-context-engineering🔄 Pipeline
The squad executes a sequential 5-phase pipeline, from requirements gathering to final context optimization:
Pipeline phases:
| Phase | Agent | Input | Output |
|---|---|---|---|
| 1 — Gathering | 🎯 Interviewer | User conversation | requirements.yaml |
| 2 — Scanning | 🔬 Scanner | Project repository | project-analysis.yaml |
| 3 — Architecture | 🏗️ Architect | Requirements + analysis | context-architecture.yaml |
| 4 — Generation | ⚡ Generator | Context architecture | Raw artifacts |
| 5 — Optimization | 🔧 Optimizer | Raw artifacts | Optimized context |
🤖 Agents
| Icon | Name | Archetype | Primary Role |
|---|---|---|---|
| 🎯 | Interviewer | Guardian | Collects requirements via structured interview; ensures no critical detail is missed before the pipeline starts |
| 🔬 | Scanner | Guardian | Scans the project repository detecting tech stack, existing patterns, configuration files, and directory structure |
| 🏗️ | Architect | Builder | Designs the context architecture based on requirements and analysis; defines layer hierarchy, scopes, and loading strategies |
| ⚡ | Generator | Builder | Generates context artifacts per the defined architecture: CLAUDE.md, rules, AGENTS.md, and memory configurations |
| 🔧 | Optimizer | Balancer | Reviews and optimizes all artifacts; applies compaction, mitigates "lost in the middle", and validates final context quality |
📋 Tasks
| Task | Agent | Description |
|---|---|---|
gatherRequirements() | 🎯 Interviewer | Structured interview to capture goals, constraints, stack, and team preferences |
scanProject() | 🔬 Scanner | Automated repository analysis: config files, dependencies, code patterns, structure |
designContextArchitecture() | 🏗️ Architect | Context hierarchy design with per-layer scope (global, agent, workflow, task) |
generateContextArtifacts() | ⚡ Generator | Generation of all artifacts: CLAUDE.md, .claude/rules/ AGENTS.md, memory configs |
optimizeContext() | 🔧 Optimizer | Compaction, deduplication, reordering, and quality validation of artifacts |
validateContextQuality() | 🔧 Optimizer | Final checklist: size, coverage, absence of redundancies, conformance with best practices |
🔀 Workflows
context_engineering_pipeline — Main Pipeline
Sequential 5-phase pipeline that executes the full flow from collection to optimization. Each phase depends on artifacts from the previous one. Recommended for new projects or initial onboarding of legacy projects.
context_optimization_cycle — Iterative Cycle
Optimization loop for projects with existing context that needs refinement. Analyzes current artifacts, identifies issues, and applies incremental improvements. Recommended for periodic maintenance and continuous improvement of already-established context.
/ce optimize
🧩 Context Engineering Approaches
The squad implements and combines five complementary context management approaches:
| Approach | Acronym | Description |
|---|---|---|
| Retrieval-Augmented Generation | RAG | Context is dynamically injected from external knowledge bases at runtime |
| Agentic Context Engineering | ACE | Agents build and refine their own context during execution, learning from each interaction |
| Hierarchical Layering | — | Context organized in layers (L0 global → L7 keyword) with controlled inheritance and overrides |
| Git Context Controller | GCC | Context tracked via git, with change history and the ability to roll back to previous versions |
| Structured Files | CLAUDE.md | Canonical structured-file pattern that organizes instructions, constraints, and project knowledge |
🏆 Best Practices 2026
| Practice | Description |
|---|---|
| 40–60% Compaction | Reduce token count while maintaining full semantic coverage via intelligent summarization |
| "Lost in the Middle" Mitigation | Position critical information at the beginning or end of context — never in the middle |
| 3-Tier Memory | Separate short-term (session), medium-term (project), and long-term (organization) memory |
| Dynamic Tool Loadout | Load only tools relevant to the current context, reducing cognitive noise |
| Context Quarantine | Isolate potentially contaminated context (errors, loops) in sandboxes before reuse |
| Path-Scoped Rules | Rules in .claude/rules/ |
| CLAUDE.md ≤ 200 lines | Main context file kept compact — details delegated to rule files |
| Context Versioning | Every context artifact versioned in git with descriptive commit messages |
📦 Generated Artifacts
The squad produces a complete set of context artifacts ready for immediate use:
CLAUDE.md— Main context file (≤ 200 lines), containing general instructions, stack, conventions, and constraints- — Contextual rules with
.claude/rules/
paths:frontmatter for selective loading by file scope AGENTS.md— Catalog of available agents with personas, capabilities, and activation examples- Memory configs — Short-, medium-, and long-term memory configurations for context persistence
- Prompt templates — Reusable templates for common tasks with typed placeholders
💻 Usage
Main Commands
# Start the full pipeline (default flow)
/ce start
# Run project scanning only
/ce scan
# Optimize existing context
/ce optimize
# Validate quality of current artifacts
/ce validate
# Inspect the generated context architecture
/ce inspect
# Help and command list
/ce helpFull Flow Example
# 1. Install the squad
npx squads add gutomec/squads-sh/nirvana-context-engineering
# 2. Start the pipeline in the target project
cd my-project
/ce start
# 3. Answer the Interviewer's questions (interactive)
# The agent will ask about: stack, team, constraints, goals
# 4. Wait for the pipeline to complete (automatic after interview)
# 5. Review the generated artifacts
ls .claude/
cat CLAUDE.md
# 6. Commit the context artifacts
git add CLAUDE.md .claude/ AGENTS.md
git commit -m "feat: context engineering artifacts [ce-pipeline]"Initial Setup — Checklist
- Squad Protocol v5 installed and configured
- Claude Code active in the project
- Squad installed via
npx squads add - Project directory with git initialized
- Write permission on and project root
.claude/
- Pipeline executed with
/ce start
- Artifacts reviewed and committed
⚙️ Configuration
squad.yaml — Main Configuration
name: nirvana-context-engineering
version: 1.0.0
slashPrefix: ce
protocol: "5.0"
settings:
maxClaudeMdLines: 200
compactionTarget: 0.5 # 50% token reduction
language: en-US
encoding: utf-8
generateAgentsMd: true
generateMemoryConfigs: true
generatePromptTemplates: true
pipeline:
workflow: context_engineering_pipeline
phases:
- agent: interviewer
task: gatherRequirements
- agent: scanner
task: scanProject
- agent: architect
task: designContextArchitecture
- agent: generator
task: generateContextArtifacts
- agent: optimizer
task: optimizeContextAgent Customization
Each agent can be customized via a YAML file in
config/agents/
# config/agents/interviewer.yaml
interviewer:
maxQuestions: 20
requiredTopics:
- stack
- teamSize
- codeConventions
- ciCdPlatform
- testingStrategy
skipIfExists:
- requirements.yamlEnvironment Variables
# Enable verbose mode in the pipeline
CE_VERBOSE=true
# Override artifact language
CE_LANGUAGE=en-US
# Disable prompt template generation
CE_SKIP_TEMPLATES=true
# Custom path for artifacts
CE_OUTPUT_DIR=.context/📁 Directory Structure
Expand full squad tree
squads/nirvana-context-engineering/ ├── README.md # Portuguese version ├── README.en.md # This file ├── squad.yaml # Main configuration ├── component-registry.md # Component registry ├── analysis.md # Design analysis │ ├── agents/ │ ├── interviewer.yaml # 🎯 Interviewer agent │ ├── scanner.yaml # 🔬 Scanner agent │ ├── architect.yaml # 🏗️ Architect agent │ ├── generator.yaml # ⚡ Generator agent │ └── optimizer.yaml # 🔧 Optimizer agent │ ├── tasks/ │ ├── gather-requirements.yaml │ ├── scan-project.yaml │ ├── design-context-architecture.yaml │ ├── generate-context-artifacts.yaml │ ├── optimize-context.yaml │ └── validate-context-quality.yaml │ ├── workflows/ │ ├── nirvana-context-engineering-pipeline.yaml │ └── context-optimization-cycle.yaml │ ├── templates/ │ ├── claude-md.md # Base template for CLAUDE.md │ ├── agents-md.md # Base template for AGENTS.md │ ├── rule-template.md # Template for contextual rules │ └── memory-config.yaml # Memory configuration template │ ├── checklists/ │ ├── quality-gate.md # Final quality checklist │ └── review-checklist.md # Manual review checklist │ ├── config/ │ └── defaults.yaml # Squad default settings │ ├── references/ │ ├── nirvana-context-engineering-guide.md │ └── best-practices-2026.md │ └── scripts/ ├── validate.sh # Local validation script └── metrics.sh # Context metrics collection
🔧 Troubleshooting
| Problem | Likely Cause | Solution |
|---|---|---|
CLAUDE.md exceeding 200 lines | Content not delegated to rules | Move detailed sections to .claude/rules/ paths: frontmatter |
Agent ignoring .claude/rules/ | Missing paths: frontmatter | Add paths: with the correct glob in the rule file header |
| Pipeline stalling at Scanner phase | Insufficient directory permissions | Check permissions with ls -la .claude/ chmod 755 .claude/ |
| Context not loading in session | AIOS Core out of date | Update with npx squads update and verify version with squads --version |
| Artifacts generated in wrong language | Incorrect language configuration | Set CE_LANGUAGE=en-US or adjust settings.language in squad.yaml |
| Duplicated instructions across files | Missing compaction step | Run /ce optimize |
AGENTS.md not reflecting real agents | Squad out of date | Reinstall with npx squads add --force gutomec/squads-sh/nirvana-context-engineering |
component-registry.md — this file is managed alongside the squad manifest and manual modifications may corrupt the squad's component registry.
🤝 Contributing
Contributions are welcome! Please follow the standard AIOS flow:
- Create a story in describing the improvement
docs/stories/
- Implement following the Story Development Cycle (SDC)
- Run the QA Gate with
@qa - Submit via
@devopswith a descriptive PR
For discussions about squad architecture, open an issue with the nirvana-context-engineering label.
📄 License
Distributed under the MIT license. See LICENSE for full details.
nirvana-context-engineering · Squad (Squad Protocol v5) · v1.0.0
Created by Luiz Gustavo Vieira Rodrigues (@gutomec)
Context Engineering is not magic — it's architecture.
Reviews
0 reviewsNo reviews yet. Be the first to review this squad!
More from Luiz Rodrigues
squad forge
Squad meta de desenvolvimento, otimização e evolução de squads agênticos — cria, valida, otimiza e moderniza qualquer artefato de squad (agentes, tasks, workflows, skills, squads inteiros, templates) com perfeição de formato, e mantém a própria base de conhecimento atualizada via pesquisa web.
ultimate landingpage
Squad fullstack para criação de landing pages de ultra-alta conversão — pipeline end-to-end com 9 agentes: discovery de produto, pesquisa de mercado e experts de copywriting, design system atômico com contraste WCAG AAA e light/dark, geração de imagens por IA, frontend Next.js com SEO e acessibilidade, backend Python FastAPI com admin panel e exportação CSV, integrações WhatsApp e email, e QA multidimensional com score por dimensão
data quality guardian
Squad especialista em qualidade de dados — profiling de datasets, detecção de anomalias, validação de schemas, geração de relatórios de qualidade e sugestão de remediações automatizadas para pipelines de dados
incident response squad
Squad especialista em resposta a incidentes para DevOps/SRE — análise de logs multi-source, correlação de causa raiz, execução de runbooks de remediação, comunicação de status e geração de post-mortems blameless
brandcraft
Squad de produção de entregáveis visuais brand-consistent: extrai design systems de URLs (Refero + live extraction), gera PDFs, PPTX, posts sociais, carrosséis e vídeos programáticos por dois caminhos (Veo 3.1 + Remotion para footage de IA; HyperFrames HTML-first determinístico para motion-design, data-viz e explainer), faz auditoria competitiva de marca, aplica um quality gate awwwards de 24 itens e um arsenal de 112 bibliotecas de UI nos HTMLs/PDFs/animações, e valida acessibilidade WCAG 2.2 AA. Pipeline com 16 agentes especializados e 16 workflows.
nirvana squad creator
Gera squads v5-compliant a partir de linguagem natural — pipeline de 11 fases começando com intent archaeology + pesquisa web (2026), depois análise grounded, geração, otimização, validação, README multi-idioma, deploy e publicação no squads.sh
notebooklm automation
Automação programática completa do Google NotebookLM — da criação de notebooks e curadoria de fontes à pesquisa por Q&A progressivo e geração de 10 formatos de conteúdo (podcast, vídeo, slides, quiz, flashcards, infográfico, mapa mental, tabela de dados, relatório), com download de artefatos orquestrado por pipeline inteligente. Suporta 50+ idiomas e error handling cross-cutting (retry, re-auth, fallback de cota).
nirvana readme architect
Squad de geração de README.md perfeito e impecável, combinando análise profunda de codebase, seleção de template por tipo de projeto, todas as features do GitHub Flavored Markdown, validação com checklist de 25+ pontos e polimento final com badges e TOC.
soc alert triage
Squad especialista em triagem de alertas SOC para cybersecurity — classificação automatizada, filtragem de falsos positivos, priorização de ameaças, enriquecimento com threat intel e geração de briefs para analistas
adaptive tutor k12
Squad especialista em tutoria adaptativa K-12 — avaliação diagnóstica, mapeamento curricular personalizado, sessões de tutoria com dificuldade adaptativa, rastreamento de progresso e relatórios para pais e educadores
resume screener squad
Squad especialista em triagem de currículos para recrutamento — parsing automatizado de CVs, matching de skills com requisitos da vaga, auditoria de vieses, ranking de candidatos e geração de resumos executivos para hiring managers
automated code review squad
Squad especialista em code review automatizado — revisão de segurança, análise lógica, verificação de padrões arquiteturais, enforcement de coding standards e geração de review summaries priorizados para PRs e commits