v1.31.0
guíaPatrón · _patronenglishversión en español

Intelligent Context System for Claude Code

5 minlectura
1059palabras
10secciones
2026-09-22última edición
4cambios

This document explains how the project scaffolding's context system works and how Claude navigates through it according to each project situation.


System Overview

The project scaffolding includes an intelligent context system that allows Claude Code to:

  1. Remember project state between sessions
  2. Understand existing functionalities, dependencies, and decisions
  3. Ask proactively to avoid errors
  4. Run standardized workflows for common tasks

System Architecture

CLAUDE.md                    ← Entry point (automatically read)
    │
    ├── _hilo/           ← Dynamic project memory
    │   ├── ESTADO_PROYECTO.json   ← Current state, phase, mode
    │   ├── FUNCIONALIDADES.md     ← What the application does
    │   ├── DEPENDENCIAS.md        ← What can break
    │   ├── DECISIONES.md          ← Why it was done this way
    │   ├── HISTORIAL_CAMBIOS.md   ← Changelog
    │   └── reuniones/             ← Meeting agreements
    │
    ├── .claude/            ← What the ecosystem leaves in the project
    │   ├── skills/         ← THE ONLY PRIMITIVE: knowledge, workflow and path-scoped rule
    │   ├── agents/         ← Subagents with their own context, invoked from skills
    │   ├── rules/          ← The rules that are always loaded
    │   ├── hooks/          ← Node, WARN-first policy
    │   └── settings.json   ← The hook wiring
    │
    └── _patron/     ← Static organization rules
        ├── 01_Estructura_Tecnica/
        ├── 02_Diseno_Usabilidad/
        ├── 03_Consideraciones_Comunes/
        └── 04_Plantillas_Documentacion/

Operation Modes

The system has 4 main modes defined in ESTADO_PROYECTO.json:

1. Mode: puesta_a_punto (Setup)

When: Existing project newly incorporated into the template

Claude's behavior:

1. Detects "puesta_a_punto" mode in ESTADO_PROYECTO.json
2. Does NOT make code changes
3. Invites to execute /onboarding
4. Asks battery of questions to contextualize
5. Documents in _hilo/
6. Upon completion, switches to "desarrollo" mode

Flow:

┌─────────────────┐     ┌──────────────┐     ┌─────────────────┐
│ New project     │ ──► │ /onboarding  │ ──► │ Development     │
│ (puesta_a_punto)│     │ (questions)  │     │ mode (ready to  │
│                 │     │              │     │  work)          │
└─────────────────┘     └──────────────┘     └─────────────────┘

2. Mode: desarrollo (Development)

When: Active project development

Claude's behavior:

1. Reads complete context at startup
2. Asks proactive questions according to task type
3. Verifies dependencies before modifying
4. Updates _hilo/ with important changes
5. Uses workflows for standard operations

Proactive questions:

SituationClaude asks
New functionality"Which module does it go in? Does it follow existing pattern?"
Modification"I've detected dependencies with [X]. Should I review impact?"
Bug fix"Steps to reproduce? Severity?"
Before coding"Do I understand the requirement correctly?"

3. Mode: mantenimiento (Maintenance)

When: Stable project, only minor corrections

Claude's behavior:

1. Conservative mode: minimal changes
2. Emphasis on not breaking existing functionality
3. Always verifies tests before changes
4. Documents all changes in HISTORIAL_CAMBIOS.md

4. Mode: soporte_uap (UAP Support)

When: Project in production supported by UAP

Claude's behavior:

1. Consults runbooks before acting
2. Prioritizes quick resolution
3. Documents incident according to template
4. Notifies about SLA impact

Claude's Navigation Flow

Session Initialization

┌─────────────────────────────────────────────────────────────┐
│ Claude Code starts                                          │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│ Reads CLAUDE.md automatically                               │
│ → Loads general instructions                               │
│ → Knows the available workflows                            │
│ → Knows which files to read                                │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│ Reads _hilo/ESTADO_PROYECTO.json                          │
│ → Identifies current mode                                  │
│ → Knows phase, version, alerts                             │
│ → Knows which modules are in development                   │
└─────────────────────────────────────────────────────────────┘
                              │
              ┌───────────────┼───────────────┐
              ▼               ▼               ▼
        [puesta_a_punto] [desarrollo]   [mantenimiento]
              │               │               │
              ▼               ▼               ▼
        Invites to       Reads complete  Conservative
        /onboarding      context         mode

Before Each Development Task

┌─────────────────────────────────────────────────────────────┐
│ Developer describes task                                    │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│ Claude identifies task type                                 │
│ → New functionality?                                        │
│ → Modification?                                             │
│ → Bug fix?                                                  │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│ Claude consults relevant context                            │
│                                                             │
│ IF it's a modification:                                     │
│   → Reads FUNCIONALIDADES.md (affected functionality)       │
│   → Reads DEPENDENCIAS.md (what can break)                  │
│   → Searches recent meetings                               │
│                                                             │
│ IF it affects architecture:                                 │
│   → Reads DECISIONES.md (relevant ADRs)                     │
│   → Verifies with _patron/                          │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│ Claude asks proactive questions                             │
│                                                             │
│ "I've detected that [X] has dependencies with [Y,Z]."       │
│ "Do you want me to analyze the impact before starting?"     │
│                                                             │
│ "I see there was a recent meeting on [date]."               │
│ "Should I review the agreements?"                           │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│ Claude implements following:                                │
│ → Rules from _patron/                               │
│ → Existing patterns in the code                            │
│ → Previous decisions (ADRs)                                │
└─────────────────────────────────────────────────────────────┘

Workflows: what you invoke by hand

There are no commands. The skill is the ecosystem's only primitive, in three classes, and what you type as /hv:x is the invocation form of a workflow skill -- not a separate artifact. There is no .claude/commands/.

ClassWho fires itFrontmatter marker
knowledgethe model, from what its description saysnone
path-scoped rulethe model, when a matching file is touchedpaths:
workflowonly a person, by typing its namedisable-model-invocation: true

That marker is the invariant: a workflow never fires on its own. A deployment, a commit or a scaffolding run is not launched by the model just because the conversation brushed past it.

How the invocation is written

InstallationYou typeWhy
plugin from the marketplace/hv:estadothe prefix is the plugin's
zip or installer/estadowith no plugin there is no prefix

Both forms are correct, each in its own mode. A message that writes them by hand is right in one and wrong in the other, so executable code resolves them with hooks/lib/helpers.js -> cmd().

Which ones exist

They are not listed here: any hand-written list goes stale with the first new skill, and this document reads as current state. The live catalogue comes from one place:

  • in a session, type / and read what autocomplete offers;
  • if you are unsure what one does, /hv:sos;
  • and the exact count is published by the ecosystem portal, derived from the inventory.

The everyday ones, to get your bearings: /hv:estado (project status), /hv:commit (commit with checks), /hv:sync (bring the Hilo up to date after significant changes), /hv:onboarding (contextualize an existing project) and /hv:verify (build, format, tests and scan before delivering).


Questions by Situation

New Functionality

PhaseQuestions
Understanding"What's the business objective?"
"Who is the end user?"
"Is it part of a larger development?"
Location"Which module?"
"Does it follow existing pattern?"
Data"Does it require new tables?"
"Does it handle sensitive data?"
Security"Which roles have access?"

Modifying Existing

PhaseQuestions
Context"Are there previous decisions to respect?"
"Were there previous problems here?"
Impact"Do you want me to analyze dependencies?"
"Are there existing tests?"
Integrations"Does it affect external systems?"
"Are there dependent batch processes?"

Bug Fix

PhaseQuestions
Reproduction"Steps to reproduce?"
"In which environment does it occur?"
Urgency"Severity?"
"Is there a workaround?"
Origin"When did it start failing?"
"Were there recent changes?"

Key Files and Their Purpose

FileClaude reads itFor
CLAUDE.mdAlways (automatic)General instructions
ESTADO_PROYECTO.jsonAlwaysKnow mode, phase, version
FUNCIONALIDADES.mdModificationsUnderstand what exists
DEPENDENCIAS.mdModificationsAvoid breaking things
DECISIONES.mdArchitectureRespect decisions
HISTORIAL_CAMBIOS.mdDeliveriesDocument changes
reuniones/According to contextRecent agreements
_patron/DevelopmentTechnical rules

Context Updates

EventUpdated filesCommand
CommitHISTORIAL_CAMBIOS.md/commit
DeliveryESTADO_PROYECTO.json, FUNCIONALIDADES.md/prepara-entrega
Important changeFUNCIONALIDADES.md, DEPENDENCIAS.md/sync
Technical decisionDECISIONES.mdManual
Meetingreuniones/YYYY-MM-DD.mdManual

Complete Flow Diagram

                    ┌──────────────────────┐
                    │   SESSION START      │
                    └──────────┬───────────┘
                               │
                               ▼
                    ┌──────────────────────┐
                    │  Read CLAUDE.md      │
                    │  Read ESTADO_PROYECTO│
                    └──────────┬───────────┘
                               │
           ┌───────────────────┼───────────────────┐
           │                   │                   │
           ▼                   ▼                   ▼
   ┌───────────────┐   ┌───────────────┐   ┌───────────────┐
   │ puesta_a_punto│   │  desarrollo   │   │ mantenimiento │
   └───────┬───────┘   └───────┬───────┘   └───────┬───────┘
           │                   │                   │
           ▼                   │                   │
   ┌───────────────┐           │                   │
   │ /onboarding   │           │                   │
   │ (questions)   │           │                   │
   └───────┬───────┘           │                   │
           │                   │                   │
           └─────────┬─────────┘                   │
                     │                             │
                     ▼                             │
           ┌───────────────────┐                   │
           │ REQUESTED TASK    │◄──────────────────┘
           └─────────┬─────────┘
                     │
                     ▼
           ┌───────────────────┐
           │ Identify task     │
           │ type              │
           └─────────┬─────────┘
                     │
     ┌───────────────┼───────────────┐
     │               │               │
     ▼               ▼               ▼
┌─────────┐    ┌─────────┐    ┌─────────┐
│ New     │    │ Modif.  │    │ Bug fix │
│ func.   │    │         │    │         │
└────┬────┘    └────┬────┘    └────┬────┘
     │              │              │
     │              ▼              │
     │    ┌─────────────────┐      │
     │    │ Read FUNCIONAL. │      │
     │    │ Read DEPENDENC. │      │
     │    │ Read meetings   │      │
     │    └────────┬────────┘      │
     │             │               │
     └──────┬──────┴───────────────┘
            │
            ▼
   ┌───────────────────┐
   │ PROACTIVE         │
   │ QUESTIONS         │
   └─────────┬─────────┘
             │
             ▼
   ┌───────────────────┐
   │ IMPLEMENTATION    │
   │ (following rules) │
   └─────────┬─────────┘
             │
             ▼
   ┌───────────────────┐
   │ /commit           │
   │ (verifications)   │
   └─────────┬─────────┘
             │
             ▼
   ┌───────────────────┐
   │ Update            │
   │ HISTORIAL_CAMBIOS │
   └───────────────────┘

Context budget: windows, thresholds and anti-patterns

The unconditional rule .claude/rules/context-optimization.md states what to do. This section holds the why and the figures, which go stale sooner than the rules.

Window per model family

FamilyModelsWindowMax outputThinking
Claude 5Fable 5.1 (claude-fable-5-1) - Opus 5 (claude-opus-5) - Sonnet 5 (claude-sonnet-5)1M tokens128Kadaptive
Claude 4.5Haiku 4.5 (claude-haiku-4-5)200K tokens64Kextended

Source: platform.claude.com/docs/en/models/overview. Models 4.6 to 4.8 and Fable 5 are legacy and share the 1M window. Review this table whenever the Claude Code default model changes; the rule itself speaks of window classes (1M / 200K) rather than models, so it does not go stale.

1M is a lot, yet an intense session burns 200-400K over 50-100 tool calls, and with adaptive thinking the model's own reasoning also takes window on long tasks. Optimising context is not thrift for its own sake: it buys longer sessions and better answers.

Thresholds for suggesting /compact

Metric1M window200K window
Tool calls in the session> 80> 30
Whole files read> 25> 10
Unrelated tasks completed> 4> 2
Consecutive build errors> 3 (stop and replan)> 3 (stop and replan)

Consumption anti-patterns

Anti-patternInstead
Reading a whole file to find one lineGrep with the pattern
Unbounded git diffgit diff --stat, then the specific file
Unbounded git loggit log --oneline -10
dotnet build with full outputdotnet build -v quiet
Reading every file in a directoryGlob + Grep to filter first
Several Grep calls in a rowone with the combined regex
Re-reading CLAUDE.md every turnit is already in context

What is always loaded and what is not

Always: CLAUDE.md with its two @imports (project state and current session), the unconditional rules in .claude/rules/, the skill listing published to the model and the agents' description. On demand: the organization standards (.claude/CLAUDE_BASE.md, which the estandares-base rule brings up when touching src/), the layer rules (activated by file path), the guides in this knowledge base and the Hilo files that are not state (DEPENDENCIAS.md, FUNCIONALIDADES.md, specs/). That separation is what keeps the start-up context inside its budget.


Owner: Technical Committee

Fuente: ovillo/_patron/SISTEMA_CONTEXTO_CLAUDE_EN.md

Ovillo v1.31.0tag v1.31.0 (2026-10-06) · sin decisiones posteriores69 skills · 19 agents · 22 hooks · 3 reglas · 15 tools · 103 decisionesfuente: ovillo/_patron/SISTEMA_CONTEXTO_CLAUDE_EN.mdCopyright 2026 Hugo Valer Rojas · Apache-2.0