Getting started
Install from PyPI // recommended
$ pip install codilay$ pip install "codilay[all]"$ pipx install codilaypip install codilay for a basic install, "codilay[all]" for Web UI + Watch mode, or pipx install codilay for a global CLI (recommended).Install from source // for development / latest
// CodiLay can also be installed directly from the GitHub repository.
$ git clone https://github.com/HarmanPreet-Singh-XYT/codilay.git && cd codilay$ pip install -e ".[all]"$ codilay setup$ codilay ..[serve] for Web UI only, .[watch] for Watch mode only, .[all] for everything, .[all,dev] to include test/dev deps.All commands
// full table — click any row to jump to the detailed entry.
codilaycodilay .codilay setupcodilay keyscodilay clean .codilay status .codilay diff .codilay chat .codilay search . "query"codilay serve .codilay watch .codilay export .codilay diff-run .codilay audit .codilay diff-doc .codilay graph .codilay triage-feedback addcodilay triage-feedback listcodilay triage-feedback hintcodilay triage-feedback removecodilay triage-feedback clearcodilay team add-usercodilay team add-factcodilay team add-decisioncodilay team add-conventioncodilay team annotatecodilay team facts / decisions / conventions / annotations / userscodilay schedule setcodilay schedule startcodilay schedule stopcodilay schedule statuscodilay schedule disablecodilay team votecodilay annotate .codilay commit-doccodilay hookscore
codilayOpens the Interactive Control Center — a full-screen TUI for managing projects, configuring providers, and launching scans without memorizing flags.
codilay# opens the interactive menucodilay .Runs the full 5-phase agent loop on the current directory. If a prior run exists, only files changed since the last Git commit are re-processed.
codilay .# document current directorycodilay ./my-project# document a specific pathcodilay setupInteractive wizard that securely stores your LLM provider, model selection, and API keys. Runs once — no need to export env vars on every session.
codilay setupcodilay keysList, add, rotate, or delete stored API keys for any configured provider.
codilay keyscodilay clean .Removes CODEBASE.md, links.json, .codilay_state.json, and any cached conversation data for the given project path.
codilay clean .# clean current directorycodilay status .Reports how many files are documented, how many sections exist, and which sections are marked stale (source changed since last doc run).
codilay status .codilay diff .Git-level diff showing which source files were modified, added, or deleted since the last codilay run.
codilay diff .chat
codilay chat .Opens an interactive chat session. Three escalation layers: doc-based (instant), deep source reading (when doc can't answer), and a learning loop that patches the doc with new answers.
codilay chat .# start chat for current directorycodilay chat ./my-projectcodilay search . "query"TF-IDF inverted index search across every past chat session for the project. Finds that retry logic discussion from two weeks ago in milliseconds.
--top NReturn top N results (default: 10)--role assistant|userFilter by message role-c <id>Restrict search to a specific conversation ID--rebuildRebuild the search index before queryingcodilay search . "authentication flow"codilay search . "error handling" --top 5 --role assistantcodilay search . "database migration" -c <conversation-id>codilay search . "query" --rebuild# rebuild index firstweb-ui
codilay serve .Starts the FastAPI server and opens the 3-layer web documentation browser: Reader (static, no LLM), Chatbot (doc context), and Deep Agent (reads source when needed).
codilay serve .# serve current directory docscodilay serve ./my-projectwatch
codilay watch .Runs CodiLay as a background daemon. Listens for filesystem events via watchdog and triggers incremental re-runs on save. Debounced to avoid redundant work.
--debounce NDebounce delay in seconds (default: 3)-vVerbose output for debuggingcodilay watch .# watch current directorycodilay watch . --debounce 5# 5-second debouncecodilay watch . -v# verbose outputexport
codilay export .Produces a compressed, token-efficient export of your documentation tailored for LLM context windows. Supports LLM-guided interactive customization, natural language queries, and pre-configured presets.
--interactiveLaunch a conversational wizard to define your export spec--query "<text>"One-shot natural language query to filter export content--preset <name>Use a saved preset (structure, api-surface, etc.)--format markdown|xml|jsonOutput format (default: markdown)--max-tokens NCap the output at N tokens--no-graphExclude the dependency graph--strip-implementationRemove function bodies to save tokens-o <file>Write output to a specific filecodilay export . --interactive# LLM-guided export wizardcodilay export . --query "just api routes and database models"# NL query modecodilay export . --preset architecture# use presetcodilay export . --strip-implementation# signatures onlycodilay diff-doc .Compares the current documentation against the snapshot from the previous run, showing exactly which sections were added, removed, or modified. Snapshots are saved automatically after every run.
--json-outputOutput diff as JSON for programmatic usecodilay diff-doc .# show doc changes since last runcodilay diff-doc . --json-outputdiff-run
codilay diff-run .Generates a focused "what changed" report instead of a full reference. Feeds git diffs and existing context to the AI to explain the impact of changes since a specific commit, tag, date, or branch.
--since <boundary>Commit hash, tag, or date (YYYY-MM-DD)--since-branch <name>Compare current branch against target (e.g. main)--update-docPatch findings directly into CODEBASE.mdcodilay diff-run . --since abc123f# since commitcodilay diff-run . --since-branch main# since branching from maincodilay diff-run . --since 2024-03-01# since dateaudit
codilay audit .Performs targeted security, architecture, performance, or quality scans. Analyzes the wire graph and file content through 60+ specialized audit lenses.
--type <category>Audit type (security, performance, architecture, quality, compliance, etc.)--mode passive|activePassive (fast, uses existing doc) or Active (deep file reading)--list-typesShow all 60+ supported audit typescodilay audit . --type security --mode passive# fast security passcodilay audit . --type architecture --mode active# deep architectural auditcodilay audit . --type performance --mode active# active performance scangraph
codilay graph .Renders and filters the full wire dependency graph. Slice by wire type, file layer, module, connection count, or direction to surface architectural hubs and reduce noise on large repos.
--wire-type import|call|refFilter to a specific wire type--layer <path>Filter to a specific directory layer--min-connections NShow only nodes with N+ connections--direction incoming|outgoing|bothFilter edge direction-x <glob>Exclude files matching a glob pattern--list-filtersList all available filter values--json-outputOutput as JSONcodilay graph . --wire-type importcodilay graph . --layer src/apicodilay graph . --min-connections 3 --direction outgoingcodilay graph . -w import -l src/core -x "tests/**"codilay graph . --list-filterscodilay graph . --json-outputtriage
codilay triage-feedback addRecord a correction for a file or glob pattern that was mis-classified during triage. Corrections are stored per-project and automatically injected into future triage prompts.
. <file> <from> <to>Project path, file, current tier, correct tier-r <reason>Reason for the correction--patternTreat the file argument as a glob patterncodilay triage-feedback add . src/auth/handler.py skim core -r "Contains critical auth logic"codilay triage-feedback add . "tests/**" core skip --pattern -r "Tests should be skipped"codilay triage-feedback listShows all recorded triage corrections for the project.
codilay triage-feedback list .codilay triage-feedback hintAttaches a free-text hint to a project type (e.g. react, django) that is injected into the triage prompt to guide classification.
codilay triage-feedback hint . react "Treat all hooks/ files as core"codilay triage-feedback removeDeletes a stored triage correction for a specific file path.
codilay triage-feedback remove . src/auth/handler.pycodilay triage-feedback clearWipes all stored triage corrections for the project. Requires --yes confirmation flag.
codilay triage-feedback clear . --yesteam
codilay team add-userRegisters a team member in the project's shared knowledge base. Used to attribute facts, decisions, and annotations.
codilay team add-user . alice --display-name "Alice Chen"codilay team add-factStores a shared fact about the project. Facts are injected into LLM context during documentation and chat sessions.
-c <category>Category (e.g. architecture, infra, api)-a <user>Author (team member username)-t <tag>Tag(s) for filtering (repeatable)codilay team add-fact . "We use Celery for async tasks" -c architecture -a alice -t backend -t infracodilay team add-decisionLogs an architectural decision record (ADR) with rationale. Surfaced to the AI during documentation runs.
-a <user>Author (team member username)-f <file>Associated file pathcodilay team add-decision . "Use PostgreSQL over MySQL" "Better JSON support, needed for our schema" -a alice -f src/db/codilay team add-conventionRecords a coding convention that the AI will respect when generating documentation and answering chat questions.
-e <example>JSON example of the convention-a <user>Authorcodilay team add-convention . "Error Handling" "All API endpoints must return structured error responses" -e '{"error": "message", "code": 400}' -a alicecodilay team annotateAttaches a team note to a specific file, optionally scoped to a line range. Visible to the AI when processing that file.
-a <user>Author-l <start>-<end>Line range (e.g. 1-50)codilay team annotate . src/api/routes.py "This file is getting too large, plan to split by domain" -a alice -l 1-50codilay team facts / decisions / conventions / annotations / usersList stored facts, decisions, conventions, file annotations, or team members. All support filtering flags.
-c <category>Filter facts by category-s active|supersededFilter decisions by status-f <file>Filter annotations by filecodilay team facts .# all factscodilay team facts . -c architecturecodilay team decisions . -s activecodilay team conventions .codilay team annotations . -f src/api/routes.pycodilay team users .codilay team voteUpvote or downvote a stored fact by its ID. Vote scores are surfaced to the AI to indicate community confidence.
codilay team vote . <fact-id> upschedule
codilay schedule setSets up automatic documentation re-runs triggered by a cron expression, new commits on a branch, or both. Runs as a background daemon with PID file management.
--cron <expr>Cron expression (e.g. "0 2 * * *" for 2am daily)--on-commitTrigger on every new commit--branch <name>Branch to watch (default: main)codilay schedule set . --cron "0 2 * * *"# daily at 2amcodilay schedule set . --on-commit --branch maincodilay schedule set . --cron "0 2 * * *" --on-commit# both triggerscodilay schedule startStarts the configured scheduler in the foreground.
-vVerbose loggingcodilay schedule start .codilay schedule start . -vcodilay schedule stopStops the running scheduler daemon for the project.
codilay schedule stop .codilay schedule statusDisplays the current schedule configuration and daemon status.
codilay schedule status .codilay schedule disableDisables the schedule without deleting it. Re-enable with schedule set.
codilay schedule disable .annotate
codilay annotate .Uses wire knowledge to write docstrings and wire comments directly into your source code. Language-aware and supports multiple annotation levels.
--dry-runPreview what would be added without writing to disk--scope <path>Restrict annotation to a specific folder or file--level docstrings|inline|fullDetail level (default: docstrings)--rollback <id>Undo a previous annotation run by timestamp IDcodilay annotate .# annotate project (docstrings)codilay annotate . --dry-run# preview onlycodilay annotate . --scope src/api/ --level full# max detail for foldercodilay annotate . --rollback 20240314_120000commit-doc
codilay commit-docReads the git diff for commits and writes a plain-language document explaining what changed in each file and why it matters. Optionally runs a second pass to score the diff across five quality dimensions.
<hash>Generate a doc for a specific commit--range <range>Generate docs for all commits in a range--contextInclude relevant CODEBASE.md sections--metricsInclude 5-dimension quality metrics analysis--allBackfill docs for every commit in the repo--last NBackfill the last N commits--from A --to BBackfill a specific commit range--author <name>Backfill only commits by a given author--path <path>Backfill only commits touching a path--forceRe-process commits that already have docs--force-metricsAdd metrics to documented commits that lack them--workers NParallel workers for backfill (default: 4)--yesSkip cost preview and run immediatelycodilay commit-doc# document the last commitcodilay commit-doc abc123fcodilay commit-doc --range main..HEADcodilay commit-doc --metricscodilay commit-doc --allcodilay commit-doc --last 20hooks
codilay hooksInstall or remove git hooks, such as automatically generating commit docs after each commit.
install <dir> --commit-docInstall post-commit doc hookuninstall <dir> --commit-docRemove post-commit doc hookcodilay hooks install . --commit-doccodilay hooks uninstall . --commit-docThe Wire Model
// CodiLay treats every import, call, and reference as a Wire.
Unresolved references that the agent is "hunting" for. These form the bridge between the processed and unprocessed parts of your codebase.
Successfully traced connections that form segments of the dependency graph. These represent verified implementation links.
Smart Triage
// High-speed classification phase to save tokens and focus on what matters.
Resilience & Recovery
// Designed to survive interruptions without losing progress or money.
codilay.config.json
// place in your project root. all fields are optional — CodiLay works without it.
{
"ignore": ["dist/**", "**/tests/**"],
"notes": "This is a React/Next.js frontend using Tailwind.",
"instructions": "Focus on data-fetching patterns and state management.",
"entryHint": "src/main.py",
"llm": {
"provider": "anthropic",
"model": "claude-3-5-sonnet-latest",
"baseUrl": "https://api.anthropic.com",
"maxTokensPerCall": 4096
},
"triage": {
"mode": "smart",
"includeTests": false,
"forceInclude": ["critical_logic/*.py"],
"forceSkip": ["legacy_v1/*.js"]
},
"chunking": {
"tokenThreshold": 6000,
"maxChunkTokens": 4000,
"overlapRatio": 0.10
},
"parallel": {
"enabled": true,
"maxWorkers": 4
}
}ignoreGlob patterns for files/folders to exclude from scans.
notesHigh-level project context provided to the AI.
instructionsSpecific documentation style or domain instructions.
entryHintPoint to the main entry file to help trace wires.
skipGeneratedOptional override for default generated/lock file ignores.
providerAI provider (e.g., anthropic, openai, google, ollama).
modelModel identifier (e.g., claude-3-5-sonnet-latest).
baseUrlCustom API base URL (useful for local models or proxies).
maxTokensPerCallMaximum output tokens per individual agent call.
modeDefault classification strategy (smart, core, skim, skip).
includeTestsWhether to process test files (defaults to false).
forceIncludePatterns to always treat as Core documentation.
forceSkipPatterns to always ignore.
tokenThresholdFiles larger than this (in tokens) are split into chunks.
maxChunkTokensTarget token count for each detail chunk.
overlapRatioContextual overlap between chunks (e.g. 0.10 for 10%).
enabledEnable/disable concurrent processing of files within the same tier.
maxWorkersMax number of concurrent LLM calls.
Multi-provider support
// CodiLay is provider-agnostic. configure globally via codilay setup or per-project via codilay.config.json.
claude-3-5-sonnet-latest ✦, claude-3-haiku-...gpt-4o, gpt-4o-mini ✦, o1 ✦, o3 ✦, ...gemini-1.5-pro, gemini-2.0-flash, ...llama3, mistral, codellama, ...llama3-70b-8192, mixtral-8x7b, ...deepseek-coder, deepseek-reasoner ✦, ...mistral-large, codestral, ...grok-beta, grok-2llama-3.1-70b-instruct, ...Any endpoint with /v1/chat/completionsSource layout
// all source lives under src/codilay/.
cli.py# Command parsing & Interactive Menuscanner.py# Git-aware file walkingtriage.py# AI-powered file categorizationprocessor.py# The Agent Loop & large file chunkingwire_manager.py# Linkage & dependency resolutiondocstore.py# Living CODEBASE.md managementchatstore.py# Persistent memory & chat historystate.py# Atomic saves & 3-backup rotationerror_tracker.py# Run-scoped error collectorpricing.py# Model pricing & cost estimationserver.py# FastAPI Intelligence Server (Web UI + API)watcher.py# File system watcher (watch mode)exporter.py# AI-friendly doc export (markdown/xml/json)export_spec.py# Export specification schema & presetsinteractive_export.py# LLM conversation handler for exportsdoc_differ.py# Section-level doc diffing & snapshotsdiff_analyzer.py# Git diff boundary resolutionchange_report.py# Change report generation (diff-run)triage_feedback.py# Triage correction storegraph_filter.py# Dependency graph filtering engineteam_memory.py# Shared team knowledge basesearch.py# Full-text conversation searchscheduler.py# Cron & commit-based auto re-runsannotator.py# Code annotation engineweb/# Premium web frontendpackage.json# Extension manifesttsconfig.json# TypeScript configsrc/extension.ts# Extension entry point — sidebar, webview, decorations, commands