Extract key context from codebase for AI agent consumption (patterns, conventions, critical files) Invalid values MUST produce a validation error before extraction begins Secret-like files MUST be redacted from any output. This includes but is not limited to: .env, .env.*, *.env *.key, *.pem, *.p12, *.pfx credentials.*, secrets.*, *_secret* API keys, tokens, passwords in any file Implementations MUST perform redaction checks before returning any content If sensitive content is detected, either redact inline (replace with [REDACTED]) or exclude the file entirely Key directories and their purposes Directory listing (depth 3) README.md package.json / setup.py / Cargo.toml Common patterns used in the codebase Import patterns Naming conventions Error handling patterns Async patterns Key dependencies and their usage package.json dependencies Import frequency analysis Coding conventions and style .eslintrc / .prettierrc tsconfig.json / jsconfig.json editorconfig Observed patterns in code Most important files to understand Entry points (index, main, app) Configuration files Type definitions Shared utilities Validate 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 list Build exclusion filter to skip matching files/directories BEFORE any read operations Exclusions MUST be applied prior to reading any files to prevent accidental exposure List 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 patterns Find entry files (index.ts, main.py, main.go, etc.) Extract high-level architecture from imports Skip files matching exclude patterns Parse 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 files Identify most-imported modules Note framework/library choices Scan 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 returned Compile findings within max_tokens budget Prioritize most critical information Format for AI agent consumption Final verification: ensure no excluded or sensitive content in output ```markdown # Project Context ## Technology Stack - Language: {language} - Framework: {framework} - Key Libraries: {libraries} ## Project Structure ``` {directory_tree} ``` ## Entry Points {entry_points} ## Coding Conventions - Naming: {naming_convention} - Formatting: {formatting_rules} - Imports: {import_pattern} ## Key Patterns {patterns} ## Critical Files {critical_files} ## Dependencies {key_dependencies} ```