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).

2installs
SAFE
context-engineeringai-agentsclaude-codeprompt-engineeringcontext-managementragmemory-management
Squads are published by third parties. squads.sh does not guarantee their safety or functionality. Use at your own risk. Read Terms
5Agents6Tasks2Workflows

🧠 nirvana-context-engineering

Version
License
Squad Protocol
Agents
Tasks

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

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
Tip
Context Engineering is not about writing better prompts — it's about architecting the agent's cognitive environment. A well-structured CLAUDE.md can reduce tokens per session by 40–60% while improving response coherence.

⚡ Installation

bash
npx squads add gutomec/squads-sh/nirvana-context-engineering
Note
Requires Squad Protocol v5 and Claude Code. No additional npm dependencies are needed — the squad operates exclusively with Markdown and YAML.

Verify installation:

bash
squads list | grep nirvana-context-engineering

🔄 Pipeline

The squad executes a sequential 5-phase pipeline, from requirements gathering to final context optimization:

Pipeline phases:

PhaseAgentInputOutput
1 — Gathering🎯 InterviewerUser conversationrequirements.yaml
2 — Scanning🔬 ScannerProject repositoryproject-analysis.yaml
3 — Architecture🏗️ ArchitectRequirements + analysiscontext-architecture.yaml
4 — Generation⚡ GeneratorContext architectureRaw artifacts
5 — Optimization🔧 OptimizerRaw artifactsOptimized context

🤖 Agents

IconNameArchetypePrimary Role
🎯InterviewerGuardianCollects requirements via structured interview; ensures no critical detail is missed before the pipeline starts
🔬ScannerGuardianScans the project repository detecting tech stack, existing patterns, configuration files, and directory structure
🏗️ArchitectBuilderDesigns the context architecture based on requirements and analysis; defines layer hierarchy, scopes, and loading strategies
GeneratorBuilderGenerates context artifacts per the defined architecture: CLAUDE.md, rules, AGENTS.md, and memory configurations
🔧OptimizerBalancerReviews and optimizes all artifacts; applies compaction, mitigates "lost in the middle", and validates final context quality
Important
Guardian agents (Interviewer and Scanner) are quality gates — they do not advance to the next phase without sufficient data. Builder agents (Architect and Generator) are executors. The Balancer (Optimizer) is the final quality arbiter.

📋 Tasks

TaskAgentDescription
gatherRequirements()🎯 InterviewerStructured interview to capture goals, constraints, stack, and team preferences
scanProject()🔬 ScannerAutomated repository analysis: config files, dependencies, code patterns, structure
designContextArchitecture()🏗️ ArchitectContext hierarchy design with per-layer scope (global, agent, workflow, task)
generateContextArtifacts()⚡ GeneratorGeneration of all artifacts: CLAUDE.md,
.claude/rules/
, AGENTS.md, memory configs
optimizeContext()🔧 OptimizerCompaction, deduplication, reordering, and quality validation of artifacts
validateContextQuality()🔧 OptimizerFinal 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.

Warning
The iterative cycle modifies existing artifacts. Always commit the current state before running
/ce optimize
in production.

🧩 Context Engineering Approaches

The squad implements and combines five complementary context management approaches:

ApproachAcronymDescription
Retrieval-Augmented GenerationRAGContext is dynamically injected from external knowledge bases at runtime
Agentic Context EngineeringACEAgents build and refine their own context during execution, learning from each interaction
Hierarchical LayeringContext organized in layers (L0 global → L7 keyword) with controlled inheritance and overrides
Git Context ControllerGCCContext tracked via git, with change history and the ability to roll back to previous versions
Structured FilesCLAUDE.mdCanonical structured-file pattern that organizes instructions, constraints, and project knowledge

🏆 Best Practices 2026

PracticeDescription
40–60% CompactionReduce token count while maintaining full semantic coverage via intelligent summarization
"Lost in the Middle" MitigationPosition critical information at the beginning or end of context — never in the middle
3-Tier MemorySeparate short-term (session), medium-term (project), and long-term (organization) memory
Dynamic Tool LoadoutLoad only tools relevant to the current context, reducing cognitive noise
Context QuarantineIsolate potentially contaminated context (errors, loops) in sandboxes before reuse
Path-Scoped RulesRules in
.claude/rules/
activated only when corresponding files are being edited
CLAUDE.md ≤ 200 linesMain context file kept compact — details delegated to rule files
Context VersioningEvery 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
  • .claude/rules/
    — Contextual rules with 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
Note
All artifacts are generated in UTF-8. Variable names, function names, and all code follow international conventions (English).

💻 Usage

Main Commands

bash
# 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 help

Full Flow Example

bash
# 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
    .claude/
    and project root
  • Pipeline executed with
    /ce start
  • Artifacts reviewed and committed

⚙️ Configuration

squad.yaml — Main Configuration
yaml
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: optimizeContext
Agent Customization

Each agent can be customized via a YAML file in

config/agents/
:

yaml
# config/agents/interviewer.yaml
interviewer:
  maxQuestions: 20
  requiredTopics:
    - stack
    - teamSize
    - codeConventions
    - ciCdPlatform
    - testingStrategy
  skipIfExists:
    - requirements.yaml
Environment Variables
bash
# 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

ProblemLikely CauseSolution
CLAUDE.md exceeding 200 linesContent not delegated to rulesMove detailed sections to
.claude/rules/
with paths: frontmatter
Agent ignoring
.claude/rules/
Missing paths: frontmatterAdd paths: with the correct glob in the rule file header
Pipeline stalling at Scanner phaseInsufficient directory permissionsCheck permissions with
ls -la .claude/
and run
chmod 755 .claude/
Context not loading in sessionAIOS Core out of dateUpdate with npx squads update and verify version with squads --version
Artifacts generated in wrong languageIncorrect language configurationSet CE_LANGUAGE=en-US or adjust settings.language in squad.yaml
Duplicated instructions across filesMissing compaction stepRun
/ce optimize
to deduplicate and compact existing artifacts
AGENTS.md not reflecting real agentsSquad out of dateReinstall with
npx squads add --force gutomec/squads-sh/nirvana-context-engineering
Warning
Never manually edit 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:

  1. Create a story in
    docs/stories/
    describing the improvement
  2. Implement following the Story Development Cycle (SDC)
  3. Run the QA Gate with @qa
  4. Submit via @devops with 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 reviews

Write a review

No reviews yet. Be the first to review this squad!

More from Luiz Rodrigues

01

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.

1824
02

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

1584
03

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

652
04

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

581
05

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.

554
06

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

544
07

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).

423
08

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.

411
09

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

391
10

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

382
11

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

382
12

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

221