Extract key context from codebase for AI agent consumption (patterns, conventions, critical files)Invalid values MUST produce a validation error before extraction beginsSecret-like files MUST be redacted from any output. This includes but is not limited to:.env, .env.*, *.env*.key, *.pem, *.p12, *.pfxcredentials.*, secrets.*, *_secret*API keys, tokens, passwords in any fileImplementations MUST perform redaction checks before returning any contentIf sensitive content is detected, either redact inline (replace with [REDACTED]) or exclude the file entirelyKey directories and their purposesDirectory listing (depth 3)README.mdpackage.json / setup.py / Cargo.tomlCommon patterns used in the codebaseImport patternsNaming conventionsError handling patternsAsync patternsKey dependencies and their usagepackage.json dependenciesImport frequency analysisCoding conventions and style.eslintrc / .prettierrctsconfig.json / jsconfig.jsoneditorconfigObserved patterns in codeMost important files to understandEntry points (index, main, app)Configuration filesType definitionsShared utilitiesValidate focus parameter against allowed_values (all, patterns, dependencies, structure, conventions)
HALT with error: "Invalid focus value '{focus}'. Allowed values: all, patterns, dependencies, structure, conventions"
Parse exclude patterns from comma-separated listBuild exclusion filter to skip matching files/directories BEFORE any read operationsExclusions MUST be applied prior to reading any files to prevent accidental exposureList directories up to depth 3 (applying exclude patterns)Identify key directory patterns (src, lib, tests, etc.)Note technology indicators (package.json, Cargo.toml, etc.)Skip any paths matching exclude patternsFind entry files (index.ts, main.py, main.go, etc.)Extract high-level architecture from importsSkip files matching exclude patternsParse linter/formatter configs (skip if in exclude list)Sample 10 representative files for pattern analysis (exclude sensitive files)Identify naming conventions (camelCase, snake_case, etc.)Extract key dependencies from package manager filesIdentify most-imported modulesNote framework/library choicesScan all collected content for sensitive patterns:
- API keys (patterns like sk-*, AKIA*, etc.)
- Tokens (JWT, bearer tokens, auth tokens)
- Passwords or secrets in config
- Private keys or certificates
Either replace with [REDACTED] or exclude the content entirely
This step is MANDATORY and must complete before any output is returnedCompile findings within max_tokens budgetPrioritize most critical informationFormat for AI agent consumptionFinal verification: ensure no excluded or sensitive content in output