# Secrets and credentials — never commit these
.env
.env.*
*.env
secrets.json
secrets.env
credentials.json
*.pem
*.key

# Doppler / credential caches
.credential-cache/

# Runtime AI data — written at session time, not version-controlled
.ai/fetch/
.ai/sessions/
.ai/tmp-*.md

# Node
node_modules/
dist/
.next/

# OS
.DS_Store
Thumbs.db

# Session state (hook-generated)
.session-health
.ai/session-context.md
.ai/cursor-proxy-env.sh
.ai/fly-deploy-env.sh
.ai/session-logs/

# Token-leak hygiene runtime — append-only event log (contains fingerprints, not values)
.ai/security-events.jsonl
# Same audit sink when the session-secrets plugin's redactor runs from the repo
# path (plugin-relative .ai/ — a local test artifact); never commit or package it.
**/.ai/security-events.jsonl
.ai/compact-summary-*.md
.ai/compact-state.json
.ai/compact-metrics.jsonl
.ai/sessions/active-task.json
.ai/stream-risk-state.json
.ai/sast-findings.json
.ai/bypass-log.jsonl
.ai/retrospective-staging/

# Coverage artifacts — generated by CI/local test runs, never commit
.coverage
coverage.xml
diff-cover-report.md

# Model routing sync temp files
.ai/model-routing-findings.txt

# Generated by build-skill-graph.py (runtime artifacts, not committed)
.ai/capability-manifest.json
.ai/skill-intent-phrases.json

# .agents/skills/ — auto-generated SKILL.md copies for Codex CLI discovery (regenerated on Stop hook)
.agents/skills/

# Agent intelligence mesh spill file (runtime telemetry; only used on request-failure paths)
.ai/mesh-spill.jsonl

# Routing telemetry — NOT tracked (contains session_id and operational identifiers)
.ai/memory/routing-telemetry.jsonl

# Legacy paths (migrated to .ai/ — prevent accidental re-addition)
.claude/memory/
.claude/traces/
.claude/session-context.md
.claude/worktrees/

# Defensive ignore for potential exports directory (current backup workflow writes to /tmp/kl-governance-backup-{DATE}/ — never commit any export files)
exports/backup-*
exports/*.json
exports/*.json.gpg

# Playwright MCP runtime cache
.playwright-mcp/

# Cross-repo PR tracking state (runtime-mutated by hooks — not versioned)
.ai/cross-repo-prs.json

# .mcp.json is safe to commit — uses ${MCP_API_KEY} env var interpolation

# Eval results — per-run files ignored; baseline.jsonl IS committed (enables regression detection in CI)
.ai/evals/results/*.jsonl
!.ai/evals/results/baseline.jsonl

# Trajectory files — full tool call inputs/outputs; may contain PII; never commit
.ai/evals/results/trajectories/

# Staged reflection context files — ephemeral gatherer output; gitignored since
# they're re-generated on demand and may contain excerpts of eval outputs
.ai/reflections/.staged/

# Session-start navigation warning (ephemeral, written by session-retrospective.py --mode inject)
.ai/recent-navigation-warning.md

# Pattern candidates from high-dysfunction sessions — consumed by /doctor, never committed
.ai/retrospective-staging/pattern_candidate_*.json

# Auto-generated system health reports (ephemeral, written by system-self-check.py)
.ai/system-health.json
.ai/system-health.md
.ai/doctor-latest.json

# Runtime session call-count files (written per-session by hooks — not versioned)
.ai/metrics/sessions/*.count

# Runtime AI audit and telemetry logs (written by hooks at session time)
# Files here are appended each turn with no downstream reader (`/analytics`,
# build-domain-hints, etc.) — untracking them eliminates per-turn stop-hook
# commit churn. Analytics-consumed telemetry (return-cap-violations.jsonl,
# fetch-outcomes.jsonl, session-costs-rollup.jsonl) intentionally stays tracked.
.ai/bypass-log.jsonl
.ai/mcp-usage.jsonl
.ai/memory/doctor-findings.jsonl
.ai/memory/doctor-baselines.json
.ai/memory/hook-latency.jsonl
# Retro 2026-07-05 (Prompt-03 review, PR #2548/#2559): join the pattern —
# both files were previously tracked but never read anywhere. See
# reports/prompt-03-retrospective-fixes-plan-2026-07-05.md § Finding 1.
.ai/memory/injected-context-metrics.jsonl
.ai/memory/guard-denials.jsonl

# Eval failure log (runtime artefact)
.ai/memory/eval-failures.jsonl
# WS1: rotated telemetry + local retrospective records (session-side only)
.ai/memory/archive/
.ai/memory/retrospectives/

# Session-scoped ephemeral memory (scope=session, discarded on Stop)
.ai/memory/session-scratch.jsonl

# Agent completion telemetry (runtime-written per session, not versioned)
.ai/memory/agent-completions.jsonl

# Async hook event queue (runtime only — events, position cursor, PID)
.ai/queue/

# Tool loop guard + delegation rate — session-scoped runtime counters
.ai/tool-loop-state*.json
.ai/delegation-rate-state.json
.ai/cursor-attribution.json
.ai/cursor-tool-telemetry.jsonl

# Edit validator + diff-reflex runtime state (hook-generated, session-local)
.ai/edit-counter.json
.ai/drift-alerts/
.ai/file-read-streak.json
.ai/trigger-state.json

# PR assessment — manifest cache and shadow review locks (SHA-keyed, session-local)
.ai/pr-manifests/
.ai/shadow-review-*.lock

# LiteLLM proxy — Fly.io runtime artifacts
deploy/litellm-proxy/.fly/

# Python bytecode
scripts/__pycache__/
__pycache__/
*.pyc
.ai/spend-cache/

# Session-local tool-health cache (per-session, not shared)
.ai/session-health.json

# Advisor eval/metrics — runtime artifacts, not versioned
.ai/metrics/advisor-eval-weekly.md
.ai/metrics/advisor-usage.jsonl

# Per-session cost log (appended by session-cost-logger.py at Stop hook;
# one line per session — keep out of git history to avoid unbounded growth)
.ai/metrics/session-costs.jsonl

# Loop harness — variant content files (see .ai/loop-experiments/.gitignore for selective tracking)
.ai/loop-experiments/**/*.md
.ai/loop-experiments/.harness.lock

# Compiled context artifacts (generated)
# .ai/compiled/*.md — un-ignored 2026-07-02: compiled context artifacts are now
# versioned + regenerated by .github/workflows/nightly-index-regen.yml

# Privileged-handling content — verbatim adversarial-tone phrases (e.g. transcribed
# legal counsel) saved here are never tracked by git. Keeps red-flag content out
# of the repo discoverability surface. See .claude/persistent-instructions.md
# § KL Note Defensibility.
.private/
**/.private/

# iOS Shortcut exports contain embedded bearer tokens; keep real exports out of git.
templates/ios-shortcuts/*.shortcut
!templates/ios-shortcuts/*.shortcut.placeholder

# openhands generator throttle stamp (local cache)
deploy/openhands/.system-prompt.stamp

# skill-graph / cursor-rules generator throttle stamps (local cache)
.ai/.skill-graph.stamp
.cursor/rules/.skill-rules.stamp

# KL transport guard shadow telemetry (runtime, not versioned)
.ai/kl-transport-shadow.jsonl

# Credential health canary local output (generated at runtime)
credential-health-report.md
.ai/memory/*.lock
.ai/sessions/
.worktrees/
