Skip to main content

Base Layer Context

Persistent, private memory for coding agents.
Never re-explain your codebase to your agent. Automatic, durable recall across sessions, machines, and restarts.

PyPI version Python 3.10+ Platform Linux 100% Local License MIT


The Payoff: Immediate Agent Recall

We meet you where you work—the console—and then stay out of your way. Once installed, your coding agent gains automatic, persistent context across all your projects.

Base Layer Context Installation Demo

When you return to your codebase after days or weeks away, your agent recalls recent work, decisions, and milestones with full cryptographic provenance:

Codex Recall Preview


Why Base Layer Context?

Coding agents suffer from agent amnesia. When a session ends, the context window vanishes. Manually copying summaries or repasting task descriptions is tedious and burns tokens.

Base Layer Context bridges this gap with a lightweight, private, system-level memory daemon:

  • 🧠 Zero Manual Effort: Automatically captures session starts, turn milestones, and completions via non-blocking lifecycle hooks.
  • 🔒 100% Local & Private: Embeddings run locally on your CPU with FastEmbed (BAAI/bge-small-en). Vectors stay on your SSD in Qdrant. Zero telemetry, zero external API calls.
  • Global Machine Scope: Work from any folder or repository; your agent can recall related work across projects without rigid directory silos.
  • 📜 Strict Provenance: No hallucinated memories. Every retrieved passage links back to exact transcript timestamps, line offsets, and session IDs.
  • 🛡️ Zero-Surprise Permissions: Runs entirely inside your Linux systemd user session with private mode 0700 directories and mode 0600 sockets. No root or sudo required.

Quickstart (30 Seconds)

1. Install package

pip install bl-context

2. Onboard your agent

blctx install codex

The interactive onboarding wizard will:

  1. Initialize private, encrypted user directories (0700).
  2. Start the lightweight background daemon (blctxd) as a systemd user service.
  3. Register the Model Context Protocol (MCP) server with Codex.
  4. Install the base-layer-context recall skill.
  5. Verify local CPU embeddings (BAAI/bge-small-en, 384 dimensions).
  6. Index recent sessions and verify end-to-end memory retrieval health.

3. Approve hooks on next launch

When prompted during installation, choose Enable automatic capture (the recommended default). On your next Codex launch, open /hooks to review and trust the 3 local Context handlers.


What to Ask Your Agent

Once onboarded, interact with your agent normally. When you need past context, simply ask:

  • "Summarize what we worked on over the last 3 days."
  • "Where did we leave off on the database migration?"
  • "What decisions were made regarding sensor calibration yesterday?"
  • "Review recent test failures and uncommitted experiments."

Explicit Tagged Notes

Agents can also persist durable, tagged authored notes at key project milestones:

"Save a progress update: sensor bridge calibrated with 0.02ms latency. Tag it #sensors #calibration."

Notes are committed to SQLite instantly and become immediately retrievable.


How It Works: Local Privacy Architecture

Base Layer Context operates as an offline, single-writer daemon communicating over a private Unix socket and the standard Model Context Protocol (MCP):

Architecture Overview

The 4 Local Components

  1. The CLI (blctx): High-level onboarding, health diagnostics, manual search, and transcript exploration.
  2. The User Daemon (blctxd): Single-writer daemon managing SQLite WAL and Qdrant local vector storage. Independent worker threads ensure queries never block during index synchronization.
  3. The Stdio MCP Server: Exposes 6 standard tools (recent_context, search_context, get_context, context_status, open_session, log_update) directly to Codex.
  4. Lifecycle Hooks: Three lightweight handlers (SessionStart, Stop, SessionEnd) that enqueue transcript snapshots into SQLite in under 2ms without holding your conversation open.

Everyday CLI Commands

Health & Diagnostics

# Check current readiness and installation health
blctx status

# Diagnose system health, verify daemon, and inspect checks
blctx doctor

Transcript Exploration (blctx explore)

Safely inspect local Codex transcript files before importing them:

# List the newest 20 transcripts on your machine
blctx explore

# Preview conversation turns and classified records
blctx explore /path/to/session.jsonl --limit 3

# View raw JSONL records, token boundaries, and byte positions
blctx explore /path/to/session.jsonl --view raw --limit 5

Terminal Memory Queries

Query your agent's memory directly from your terminal:

# View recent turns across the last 3 days
blctx recent --days 3

# Semantic search across historical sessions
blctx search "why did we switch to batched inference?"

# Check indexing status and background jobs
blctx index-status

Uninstallation & Clean Removal

# Deactivate integration, stop daemon, and remove hooks (retains database)
blctx uninstall codex

# Complete purge (removes all database records and vectors; preserves transcripts)
blctx uninstall codex --purge

Security, Permissions & Storage Layout

Context enforces strict file permission boundaries:

Purpose Path Mode Access
Data ~/.local/share/bl-context/ 0700 SQLite database (context.db, 0600) and Qdrant vectors
Config ~/.config/bl-context/ 0700 Systemd user service unit (blctxd-*.service)
Cache ~/.cache/bl-context/ 0700 Pinned FastEmbed model weights (SHA-256 verified)
State ~/.local/state/bl-context/ 0700 Installation manifest & Unix socket (daemon.sock, 0600)
  • Overrides: Respects absolute XDG_DATA_HOME, XDG_CONFIG_HOME, XDG_CACHE_HOME, and XDG_STATE_HOME.
  • Isolation: No sudo, no system-level daemon, no open network ports.

Documentation & Contributing


License

MIT © Base Layer Context Contributors

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bl_context-0.0.9.tar.gz (92.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bl_context-0.0.9-py3-none-any.whl (72.0 kB view details)

Uploaded Python 3

File details

Details for the file bl_context-0.0.9.tar.gz.

File metadata

  • Download URL: bl_context-0.0.9.tar.gz
  • Upload date:
  • Size: 92.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bl_context-0.0.9.tar.gz
Algorithm Hash digest
SHA256 ab78d0ce788ccd0f2f9b2c02a4262f983d342e3dccc95804eb4d25fb8cff46e3
MD5 087adf3a172372c06e0b6e401e7650f5
BLAKE2b-256 e726114adc074f899ad4184232d0aadca2a3f894a92d2058a5f6aee27f9292cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for bl_context-0.0.9.tar.gz:

Publisher: publish.yml on gnulnx/Context

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bl_context-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: bl_context-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 72.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bl_context-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 cd08eb081b5c582cb1129b12ca34780ea3ee5da67252d61e69a36d5fcdd5684e
MD5 25882d6f66507455edf73fcb476ffc23
BLAKE2b-256 6a2ad0764d7d18f6f0fc10afddcaa21d6364682a17123d46bbb8f56901e3a088

See more details on using hashes here.

Provenance

The following attestation bundles were made for bl_context-0.0.9-py3-none-any.whl:

Publisher: publish.yml on gnulnx/Context

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

This release

0.0.9 This release

2 files

0.0.8

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page