## docs

CLI Reference

// all 30+ commands, flags, and examples — sourced directly from the CodiLay README.

30+
commands
14
groups
600+
tests
MIT
license
## installation

Getting started

Install from PyPI // recommended

basic$ pip install codilay
all$ pip install "codilay[all]"
global$ pipx install codilay
tip: // use pip 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.

clone$ git clone https://github.com/HarmanPreet-Singh-XYT/codilay.git && cd codilay
install$ pip install -e ".[all]"
setup$ codilay setup
run$ codilay .
install variants: // use .[serve] for Web UI only, .[watch] for Watch mode only, .[all] for everything, .[all,dev] to include test/dev deps.
## quick-reference

All commands

// full table — click any row to jump to the detailed entry.

COMMAND
ACTION
codilay
CORELaunch the Interactive Menu
codilay .
COREDocument current directory (incremental)
codilay setup
COREConfigure provider, model, and API keys
codilay keys
COREManage stored API keys
codilay clean .
COREWipe all generated artifacts
codilay status .
COREShow documentation coverage and stale sections
codilay diff .
CORESee what changed in files since the last run
codilay chat .
CHATStart a Chat session about the project
codilay search . "query"
CHATFull-text search across all past conversations
codilay serve .
WEB-UILaunch the Web UI
codilay watch .
WATCHWatch for file changes, auto-update docs
codilay export .
EXPORTExport docs in AI-friendly format
codilay diff-run .
DIFF-RUNDocument code changes only since a boundary
codilay audit .
AUDITRun automated codebase audits
codilay diff-doc .
EXPORTShow section-level documentation diff between runs
codilay graph .
GRAPHView and filter the dependency graph
codilay triage-feedback add
TRIAGEFlag an incorrect triage decision
codilay triage-feedback list
TRIAGEList all stored triage corrections
codilay triage-feedback hint
TRIAGESet a project-type hint for triage
codilay triage-feedback remove
TRIAGERemove feedback for a specific file
codilay triage-feedback clear
TRIAGEClear all triage feedback
codilay team add-user
TEAMAdd a team member
codilay team add-fact
TEAMRecord a team fact
codilay team add-decision
TEAMRecord an architectural decision
codilay team add-convention
TEAMAdd a coding convention
codilay team annotate
TEAMAnnotate a specific file
codilay team facts / decisions / conventions / annotations / users
TEAMList team knowledge
codilay schedule set
SCHEDULEConfigure a doc update schedule
codilay schedule start
SCHEDULEStart the scheduler
codilay schedule stop
SCHEDULEStop a running scheduler
codilay schedule status
SCHEDULECheck current schedule
codilay schedule disable
SCHEDULEDisable the schedule
codilay team vote
TEAMVote on a fact
codilay annotate .
ANNOTATEWrite docs back into source files
codilay commit-doc
COMMIT-DOCGenerate plain-language commit documentation
codilay hooks
HOOKSManage git hooks
## core

core

codilay
CORE
Launch the Interactive Menu

Opens the Interactive Control Center — a full-screen TUI for managing projects, configuring providers, and launching scans without memorizing flags.

EXAMPLES
$codilay# opens the interactive menu
codilay .
CORE
Document current directory (incremental)

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.

EXAMPLES
$codilay .# document current directory
$codilay ./my-project# document a specific path
codilay setup
CORE
Configure provider, model, and API keys

Interactive wizard that securely stores your LLM provider, model selection, and API keys. Runs once — no need to export env vars on every session.

EXAMPLES
$codilay setup
codilay keys
CORE
Manage stored API keys

List, add, rotate, or delete stored API keys for any configured provider.

EXAMPLES
$codilay keys
codilay clean .
CORE
Wipe all generated artifacts

Removes CODEBASE.md, links.json, .codilay_state.json, and any cached conversation data for the given project path.

EXAMPLES
$codilay clean .# clean current directory
codilay status .
CORE
Show documentation coverage and stale sections

Reports how many files are documented, how many sections exist, and which sections are marked stale (source changed since last doc run).

EXAMPLES
$codilay status .
codilay diff .
CORE
See what changed in files since the last run

Git-level diff showing which source files were modified, added, or deleted since the last codilay run.

EXAMPLES
$codilay diff .
## chat

chat

codilay chat .
CHAT
Start a Chat session about the project

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.

EXAMPLES
$codilay chat .# start chat for current directory
$codilay chat ./my-project
codilay search . "query"
CHAT
Full-text search across all past conversations

TF-IDF inverted index search across every past chat session for the project. Finds that retry logic discussion from two weeks ago in milliseconds.

FLAGS
--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 querying
EXAMPLES
$codilay search . "authentication flow"
$codilay search . "error handling" --top 5 --role assistant
$codilay search . "database migration" -c <conversation-id>
$codilay search . "query" --rebuild# rebuild index first
## web-ui

web-ui

codilay serve .
WEB-UI
Launch the Web UI

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).

EXAMPLES
$codilay serve .# serve current directory docs
$codilay serve ./my-project
## watch

watch

codilay watch .
WATCH
Watch for file changes, auto-update docs

Runs CodiLay as a background daemon. Listens for filesystem events via watchdog and triggers incremental re-runs on save. Debounced to avoid redundant work.

FLAGS
--debounce NDebounce delay in seconds (default: 3)
-vVerbose output for debugging
EXAMPLES
$codilay watch .# watch current directory
$codilay watch . --debounce 5# 5-second debounce
$codilay watch . -v# verbose output
## export

export

codilay export .
EXPORT
Export docs in AI-friendly format

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.

FLAGS
--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 file
EXAMPLES
$codilay export . --interactive# LLM-guided export wizard
$codilay export . --query "just api routes and database models"# NL query mode
$codilay export . --preset architecture# use preset
$codilay export . --strip-implementation# signatures only
codilay diff-doc .
EXPORT
Show section-level documentation diff between runs

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.

FLAGS
--json-outputOutput diff as JSON for programmatic use
EXAMPLES
$codilay diff-doc .# show doc changes since last run
$codilay diff-doc . --json-output
## diff-run

diff-run

codilay diff-run .
DIFF-RUN
Document code changes only since a boundary

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.

FLAGS
--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.md
EXAMPLES
$codilay diff-run . --since abc123f# since commit
$codilay diff-run . --since-branch main# since branching from main
$codilay diff-run . --since 2024-03-01# since date
## audit

audit

codilay audit .
AUDIT
Run automated codebase audits

Performs targeted security, architecture, performance, or quality scans. Analyzes the wire graph and file content through 60+ specialized audit lenses.

FLAGS
--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 types
EXAMPLES
$codilay audit . --type security --mode passive# fast security pass
$codilay audit . --type architecture --mode active# deep architectural audit
$codilay audit . --type performance --mode active# active performance scan
## graph

graph

codilay graph .
GRAPH
View and filter the dependency 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.

FLAGS
--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 JSON
EXAMPLES
$codilay graph . --wire-type import
$codilay graph . --layer src/api
$codilay graph . --min-connections 3 --direction outgoing
$codilay graph . -w import -l src/core -x "tests/**"
$codilay graph . --list-filters
$codilay graph . --json-output
## triage

triage

codilay triage-feedback add
TRIAGE
Flag an incorrect triage decision

Record 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.

FLAGS
. <file> <from> <to>Project path, file, current tier, correct tier
-r <reason>Reason for the correction
--patternTreat the file argument as a glob pattern
EXAMPLES
$codilay 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 list
TRIAGE
List all stored triage corrections

Shows all recorded triage corrections for the project.

EXAMPLES
$codilay triage-feedback list .
codilay triage-feedback hint
TRIAGE
Set a project-type hint for triage

Attaches a free-text hint to a project type (e.g. react, django) that is injected into the triage prompt to guide classification.

EXAMPLES
$codilay triage-feedback hint . react "Treat all hooks/ files as core"
codilay triage-feedback remove
TRIAGE
Remove feedback for a specific file

Deletes a stored triage correction for a specific file path.

EXAMPLES
$codilay triage-feedback remove . src/auth/handler.py
codilay triage-feedback clear
TRIAGE
Clear all triage feedback

Wipes all stored triage corrections for the project. Requires --yes confirmation flag.

EXAMPLES
$codilay triage-feedback clear . --yes
## team

team

codilay team add-user
TEAM
Add a team member

Registers a team member in the project's shared knowledge base. Used to attribute facts, decisions, and annotations.

EXAMPLES
$codilay team add-user . alice --display-name "Alice Chen"
codilay team add-fact
TEAM
Record a team fact

Stores a shared fact about the project. Facts are injected into LLM context during documentation and chat sessions.

FLAGS
-c <category>Category (e.g. architecture, infra, api)
-a <user>Author (team member username)
-t <tag>Tag(s) for filtering (repeatable)
EXAMPLES
$codilay team add-fact . "We use Celery for async tasks" -c architecture -a alice -t backend -t infra
codilay team add-decision
TEAM
Record an architectural decision

Logs an architectural decision record (ADR) with rationale. Surfaced to the AI during documentation runs.

FLAGS
-a <user>Author (team member username)
-f <file>Associated file path
EXAMPLES
$codilay team add-decision . "Use PostgreSQL over MySQL" "Better JSON support, needed for our schema" -a alice -f src/db/
codilay team add-convention
TEAM
Add a coding convention

Records a coding convention that the AI will respect when generating documentation and answering chat questions.

FLAGS
-e <example>JSON example of the convention
-a <user>Author
EXAMPLES
$codilay team add-convention . "Error Handling" "All API endpoints must return structured error responses" -e '{"error": "message", "code": 400}' -a alice
codilay team annotate
TEAM
Annotate a specific file

Attaches a team note to a specific file, optionally scoped to a line range. Visible to the AI when processing that file.

FLAGS
-a <user>Author
-l <start>-<end>Line range (e.g. 1-50)
EXAMPLES
$codilay team annotate . src/api/routes.py "This file is getting too large, plan to split by domain" -a alice -l 1-50
codilay team facts / decisions / conventions / annotations / users
TEAM
List team knowledge

List stored facts, decisions, conventions, file annotations, or team members. All support filtering flags.

FLAGS
-c <category>Filter facts by category
-s active|supersededFilter decisions by status
-f <file>Filter annotations by file
EXAMPLES
$codilay team facts .# all facts
$codilay team facts . -c architecture
$codilay team decisions . -s active
$codilay team conventions .
$codilay team annotations . -f src/api/routes.py
$codilay team users .
codilay team vote
TEAM
Vote on a fact

Upvote or downvote a stored fact by its ID. Vote scores are surfaced to the AI to indicate community confidence.

EXAMPLES
$codilay team vote . <fact-id> up
## schedule

schedule

codilay schedule set
SCHEDULE
Configure a doc update schedule

Sets 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.

FLAGS
--cron <expr>Cron expression (e.g. "0 2 * * *" for 2am daily)
--on-commitTrigger on every new commit
--branch <name>Branch to watch (default: main)
EXAMPLES
$codilay schedule set . --cron "0 2 * * *"# daily at 2am
$codilay schedule set . --on-commit --branch main
$codilay schedule set . --cron "0 2 * * *" --on-commit# both triggers
codilay schedule start
SCHEDULE
Start the scheduler

Starts the configured scheduler in the foreground.

FLAGS
-vVerbose logging
EXAMPLES
$codilay schedule start .
$codilay schedule start . -v
codilay schedule stop
SCHEDULE
Stop a running scheduler

Stops the running scheduler daemon for the project.

EXAMPLES
$codilay schedule stop .
codilay schedule status
SCHEDULE
Check current schedule

Displays the current schedule configuration and daemon status.

EXAMPLES
$codilay schedule status .
codilay schedule disable
SCHEDULE
Disable the schedule

Disables the schedule without deleting it. Re-enable with schedule set.

EXAMPLES
$codilay schedule disable .
## annotate

annotate

codilay annotate .
ANNOTATE
Write docs back into source files

Uses wire knowledge to write docstrings and wire comments directly into your source code. Language-aware and supports multiple annotation levels.

FLAGS
--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 ID
EXAMPLES
$codilay annotate .# annotate project (docstrings)
$codilay annotate . --dry-run# preview only
$codilay annotate . --scope src/api/ --level full# max detail for folder
$codilay annotate . --rollback 20240314_120000
## commit-doc

commit-doc

codilay commit-doc
COMMIT-DOC
Generate plain-language commit documentation

Reads 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.

FLAGS
<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 immediately
EXAMPLES
$codilay commit-doc# document the last commit
$codilay commit-doc abc123f
$codilay commit-doc --range main..HEAD
$codilay commit-doc --metrics
$codilay commit-doc --all
$codilay commit-doc --last 20
## hooks

hooks

codilay hooks
HOOKS
Manage git hooks

Install or remove git hooks, such as automatically generating commit docs after each commit.

FLAGS
install <dir> --commit-docInstall post-commit doc hook
uninstall <dir> --commit-docRemove post-commit doc hook
EXAMPLES
$codilay hooks install . --commit-doc
$codilay hooks uninstall . --commit-doc
## core-concepts

The Wire Model

// CodiLay treats every import, call, and reference as a Wire.

OPEN WIRES

Unresolved references that the agent is "hunting" for. These form the bridge between the processed and unprocessed parts of your codebase.

CLOSED WIRES

Successfully traced connections that form segments of the dependency graph. These represent verified implementation links.

## core-concepts

Smart Triage

// High-speed classification phase to save tokens and focus on what matters.

CORE
SKIM
SKIP
Full architectural analysis and deep documentation.
Metadata and signatures only — saves tokens on minor utilities.
Ignores boilerplate, generated code, and platform noise.
## resilience

Resilience & Recovery

// Designed to survive interruptions without losing progress or money.

STATE BACKUPS
Saves atomically after every file. Keeps 3 rolling backups (.bak.1, .bak.2, .bak.3) for auto-recovery if primary state is corrupt.
RESUME FROM ANY POINT
Whether Ctrl+C, crash, or API failure, the run resumes exactly where it stopped with zero-cost re-verification.
SMART RESUME PREVIEW
Interactively previews processed vs. remaining files with token cost clarity before confirmation.
LOCK PREVENTION
Uses PID-validated lock files to prevent concurrent runs on the same project path.
AUTH-ERROR PAUSE
If an API key expires mid-run, the process pauses and saves state, allowing you to update keys and resume.
COMPLETE ERROR PANEL
Displays a structured summary of every skip, warning, and non-fatal error at the end of the run.
## config

codilay.config.json

// place in your project root. all fields are optional — CodiLay works without it.

codilay.config.json
{
  "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
  }
}
CATEGORY
KEY
TYPE
DESCRIPTION
General
ignore
List[str]

Glob patterns for files/folders to exclude from scans.

notes
str

High-level project context provided to the AI.

instructions
str

Specific documentation style or domain instructions.

entryHint
str

Point to the main entry file to help trace wires.

skipGenerated
List[str]

Optional override for default generated/lock file ignores.

LLM
provider
str

AI provider (e.g., anthropic, openai, google, ollama).

model
str

Model identifier (e.g., claude-3-5-sonnet-latest).

baseUrl
str

Custom API base URL (useful for local models or proxies).

maxTokensPerCall
int

Maximum output tokens per individual agent call.

Triage
mode
str

Default classification strategy (smart, core, skim, skip).

includeTests
bool

Whether to process test files (defaults to false).

forceInclude
List[str]

Patterns to always treat as Core documentation.

forceSkip
List[str]

Patterns to always ignore.

Chunking
tokenThreshold
int

Files larger than this (in tokens) are split into chunks.

maxChunkTokens
int

Target token count for each detail chunk.

overlapRatio
float

Contextual overlap between chunks (e.g. 0.10 for 10%).

Parallel
enabled
bool

Enable/disable concurrent processing of files within the same tier.

maxWorkers
int

Max number of concurrent LLM calls.

## providers

Multi-provider support

// CodiLay is provider-agnostic. configure globally via codilay setup or per-project via codilay.config.json.

PROVIDER
TYPE
MODELS
Anthropic
CLOUD
claude-3-5-sonnet-latest ✦, claude-3-haiku-...
OpenAI
CLOUD
gpt-4o, gpt-4o-mini ✦, o1 ✦, o3 ✦, ...
Google Gemini
CLOUD
gemini-1.5-pro, gemini-2.0-flash, ...
Ollama
LOCAL
llama3, mistral, codellama, ...
Groq
LOCAL
llama3-70b-8192, mixtral-8x7b, ...
DeepSeek
CLOUD
deepseek-coder, deepseek-reasoner ✦, ...
Mistral
CLOUD
mistral-large, codestral, ...
xAI
CLOUD
grok-beta, grok-2
Llama Cloud
CLOUD
llama-3.1-70b-instruct, ...
OpenAI-compatible
CUSTOM
Any endpoint with /v1/chat/completions
## project-structure

Source layout

// all source lives under src/codilay/.

src/codilay/
cli.py# Command parsing & Interactive Menu
scanner.py# Git-aware file walking
triage.py# AI-powered file categorization
processor.py# The Agent Loop & large file chunking
wire_manager.py# Linkage & dependency resolution
docstore.py# Living CODEBASE.md management
chatstore.py# Persistent memory & chat history
state.py# Atomic saves & 3-backup rotation
error_tracker.py# Run-scoped error collector
pricing.py# Model pricing & cost estimation
server.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 & presets
interactive_export.py# LLM conversation handler for exports
doc_differ.py# Section-level doc diffing & snapshots
diff_analyzer.py# Git diff boundary resolution
change_report.py# Change report generation (diff-run)
triage_feedback.py# Triage correction store
graph_filter.py# Dependency graph filtering engine
team_memory.py# Shared team knowledge base
search.py# Full-text conversation search
scheduler.py# Cron & commit-based auto re-runs
annotator.py# Code annotation engine
web/# Premium web frontend
vscode-extension/EXT
package.json# Extension manifest
tsconfig.json# TypeScript config
src/extension.ts# Extension entry point — sidebar, webview, decorations, commands
© 2026 CodiLay — open source, MIT license