Cognitive Context Layer

AI가 인식하는 것을 결정하는 시스템
당신의 AI가 무엇을 보는지.

AI 에이전트를 위한 context engineering layer모델 양쪽 모두에 있는 단일 로컬 바이너리. LeanCTX는 파일 읽기부터 검증된 출력까지 AI 컨텍스트의 전체 수명 주기를 인식하고, 압축하며, 기억하고, 라우팅하고, 관리합니다.

Cognitive Context Layer

인지적 Context Layer란 무엇인가요?

Cognitive Context Layer는 AI 도구와 코드베이스 사이의 인프라입니다. 어떤 파일을 읽을지, 출력을 어떻게 압축할지, 세션 간에 어떤 지식이 지속될지, 그리고 결과가 전달되기 전에 품질 표준을 충족하는지를 제어합니다.

AI 에이전트
LeanCTX Cognitive Context Layer
I/O Intelligence Memory Verify
사용자 코드 및 도구
시스템 청사진

구축 도면

배포된 바이너리의 프로세스 토폴로지: 7개의 진입점, 1개의 런타임, 1세트의 로컬 스토어. 아래의 모든 박스는 실제 모듈, 포트 또는 디스크 파일에 매핑됩니다.

데이터 흐름

단일 읽기 작업이 거치는 과정

Sheet 2는 요청 하나가 런타임을 거쳐 단계별로 어떻게 처리되는지 추적하며, 반복적인 읽기를 거의 무료로 만드는 캐시 단락 회로까지 포함합니다. 셸 경로는 동일한 계산을 병렬로 실행합니다.

사양

엔지니어링 데이터 시트

도면 뒤의 참조 테이블: 모든 표면과 그 운송 및 수명 주기, 디스크 상 레이아웃, 적응형 학습 계층, 그리고 런타임이 강제하는 보안 경계.<br>

A프로세스 모델

모든 표면은 다른 역할을 하는 동일한 바이너리입니다. 클라우드 연결이 필요하지 않으며, 모든 것이 로컬 우선으로 바인딩됩니다.

REF SURFACE TRANSPORT ENDPOINT LIFECYCLE 명령어
01 MCP server (stdio) JSON-RPC over stdin/stdout spawned per editor session child process of the editor lean-ctx
02 MCP server (HTTP) MCP Streamable HTTP localhost, configurable --host/--port foreground or service lean-ctx serve
03 IPC daemon Unix Domain Socket OS data dir, e.g. ~/Library/Application Support/lean-ctx/daemon.sock launchd / systemd autostart lean-ctx serve --daemon
04 Shell hook process exec, compressed stdout wraps IDE bash calls + interactive shells per command lean-ctx -c "<cmd>"
05 API proxy HTTP (LLM API pass-through) localhost:4444 (default) on demand lean-ctx proxy start
06 Web dashboard HTTP + bearer token localhost:3333 (default, --port) on demand lean-ctx dashboard
07 Terminal UI TTY (in-place redraw) live event stream / 1 s refresh interactive lean-ctx watch · gain --live

B저장소 레이아웃 — 로컬 XDG 디렉토리

영구 상태는 XDG 기본 디렉토리 아래의 일반 파일입니다: 검사 가능하고, 내보내기 가능하며, 삭제 가능합니다. 이 로컬 폴더 외에는 숨겨진 데이터베이스가 없습니다.

아티팩트 FORM 목적
config.toml TOML Single config file — integration mode, compression, providers, opt-outs (config dir)
cache/ content-addressed Session file cache; unchanged re-reads collapse to ~13-token stubs (cache dir)
bm25 index inverted index Lexical search over code chunks + provider documents (data dir)
context_graph/ property graph Imports, calls, types across files and repos — powers map mode + deep queries (data dir)
knowledge SQLite Persistent facts, decisions, rooms — recalled across sessions, CCP (data dir)
savings ledger append-only JSONL Every compression event; Ed25519-signable for audit (data dir)
litm_calibration.json JSON Learned context-position hit rates (lost-in-the-middle calibration) (cache dir)
events.jsonl event stream Live feed consumed by watch, dashboard and efficacy reports (state dir)

C적응형 학습 레이어

7가지 온라인 학습 메커니즘이 바운스 및 편집 실패와 같은 품질 신호를 기반으로 사용자의 실제 사용에 맞춰 압축을 조정합니다. 심층 분석: 적응형 학습 →

  • L1
    Adaptive thresholds Online-learned compression aggressiveness from quality signals (bounces, edit failures, clean runs)
  • L2
    LITM calibration Empirical placement of critical context at positions the model actually attends to
  • L3
    Stigmergic scent field Multi-agent coordination via decaying markers: claimed, done, stuck, hot, avoid
  • L4
    Delta playbook Incremental checkpoint snapshots that survive context compaction
  • L5
    Query-conditioned IB Information-Bottleneck compression fused with query relevance
  • L6
    Theta-gamma chunking Wakeup facts grouped in attention-friendly bursts
  • L7
    Semantic dedup Likelihood-scored redundancy filtering across the session

D보안 경계

런타임에서 강제되는 하드 보장입니다. 보안 모델 →

  • PathJail Every file access is canonicalised and confined to the workspace root
  • IDE config-dir jail Home-level IDE/agent config dirs (~/.claude, ~/.codex, ~/.codebuddy, …) are writable only when allow_ide_config_dirs is opted in; otherwise PathJail blocks them
  • Shell allowlist Deny-by-default command policy for agent-issued shell executions
  • Local-first All processing on-device; dashboard binds to localhost and requires a bearer token
  • Signed evidence Savings ledger entries are Ed25519-signable and batch-verifiable
통합 모드

단일 바이너리. 세 가지 방식의 진입점.

LeanCTX는 각 에이전트에 대해 최적의 통합 모드를 자동으로 선택합니다: CLI-Redirect는 MCP 오버헤드 없이 편집기 규칙을 통해 LeanCTX CLI를 구동하고, Hybrid는 MCP 캐시 읽기와 셸 압축 훅을 결합하며, Full MCP는 프로토콜 전용 편집기를 위한 최대 도구 액세스를 제공합니다.

CLI-Redirect
규칙 기반 및 터미널 우선 에이전트, 그리고 CI용
에디터 규칙이 모든 읽기, 검색 및 셸 호출을 CLI를 통해 라우팅합니다. MCP 서버나 스키마 오버헤드가 없습니다.
lean-ctx -c / read / grep
Hybrid
Cursor, Claude Code, Codex, Windsurf 및 20개 이상의 에이전트의 기본값
캐시된 읽기를 위한 MCP(13 토큰), 셸 명령어 및 검색을 위한 CLI를 결합하여 두 마리 토끼를 모두 잡았습니다.
MCP cache + CLI shell/search
Full MCP
JetBrains, VS Code, Neovim, Emacs, Zed용
지연 도구 세트를 가진 81개의 모든 도구를 MCP 프로토콜을 통해 사용하며, MCP가 필요한 에이전트에 이상적입니다.
81 tools via MCP + lazy tool set

어떤 경우든 LeanCTX가 에디터에 맞는 모드를 자동으로 선택합니다. 지원되는 30개 이상의 도구 보기

백그라운드 데몬

항상 켜짐. 항상 당신의 것.

작은 백그라운드 서비스가 세션을 따뜻하게 유지하여 캐시 적중이 즉각적이고 메모리가 항상 준비되게 합니다. 설정 중에 자동으로 시작하고, 업데이트 시 스스로 재시작하며, 정리까지 알아서 처리합니다. 관리할 것이 없습니다.

lean-ctx serve --status
$ lean-ctx serve --status
Daemon running (PID 4139)
Endpoint: ~/Library/Application Support/lean-ctx/daemon.sock (ready)
PID file: ~/Library/Application Support/lean-ctx/daemon.pid
# autostart on login:
$ lean-ctx daemon enable # launchd / systemd
검증

모든 출력은 증거를 담고 있습니다

LeanCTX는 모든 세션에 대해 증명 아티팩트를 생성합니다: 어떤 파일이 읽혔는지, 무엇이 압축되었는지, 어떤 검사가 통과했는지, 그리고 토큰이 어떻게 사용되었는지. 이를 통해 AI 작업은 감사 가능하고, 재현 가능하며, 신뢰할 수 있게 됩니다.

한 문단 정의

LeanCTX (Lean Context의 약자)는 AI 에이전트를 위한 오픈 소스 context engineering layer입니다. 로컬 Rust 바이너리 하나가 에이전트가 읽을 내용을 결정합니다(10가지 읽기 모드, 토큰 60–90% 절감, ~13-토큰 캐시 재읽기). 학습한 내용은 기억하고(지속적인 세션, 지식 그래프), 접근하는 것을 보호하며(PathJail, 비밀 정보 제거, 예산, 주입 감지) 저장하는 내용을 증명합니다(Ed25519 서명 원장, 재현 가능한 벤치마크). 선택적 로컬 프록시는 전송되는 내용—요청의 시스템 프롬프트, 기록 및 도구 출력—을 압축하며, 이는 와이어 상에서 prompt-cache에 안전합니다. 압축은—읽기 측과 와이어 측 모두—다섯 개 서브시스템 중 하나이며, 모든 원본 데이터는 로컬에서 검색 가능하게 유지됩니다. MCP와 셸 후크를 통해 30개 이상의 AI 코딩 도구와 작동하며; Python, TypeScript 및 Rust SDK를 갖춘 버전 관리된 /v1 API를 통해 모든 에이전트에 임베드할 수 있습니다. 로컬 사용은 CI에 의해 영구적으로 무료입니다.

전체 스토리 읽기

컨텍스트의 제어권을 되찾으세요.

모델 양쪽 모두에 있는 단일 로컬 바이너리. LeanCTX는 파일 읽기부터 검증된 출력까지 AI 컨텍스트의 전체 수명 주기를 인식하고, 압축하며, 기억하고, 라우팅하고, 관리합니다.