Skip to main content

Compaction-resistant context layer for AI coding agents

Project description

know

AI-powered context drift detector for coding projects. Watches git diffs and uses an LLM to detect when code changes diverge from the planned task.

Installation

pip install know

Quick Start

# Launch the interactive TUI
know

# Or use one-shot CLI commands
know init            # Create .context.yaml
know status          # Check for context drift
know update --task "Implement auth"
know hook install    # Auto-check on commits

Interactive TUI

Running know with no arguments opens an interactive dashboard with slash commands:

know> /help

Commands

Command Description
/status Run drift check against current changes
/init Create a .context.yaml in current dir
/update Interactively update task, goals, rules
/key Set or view API keys
/model Switch LLM model
/settings Show current configuration
/hook Install/uninstall git pre-commit hook
/help Show all available commands
/quit Exit the TUI

Tab-completion and command history are built in.

API Keys

know ships with a built-in Gemini API key so it works out of the box. To use your own key:

know> /key gemini
API key (input hidden): ****

Keys are stored in ~/.know/config.yaml (permissions: owner-only read/write).

Using Other Providers

know> /model gpt-4o
know> /key openai
know> /model claude-sonnet-4-20250514
know> /key anthropic
know> /model ollama/llama3

Any model supported by LiteLLM can be used.

You can also set keys via environment variables (GEMINI_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY) — these take priority over stored keys.

.context.yaml Schema

project_name: my-project
goals:
  - Define project goals
current_task:
  id: "1"
  description: Initial setup
  status: active        # active | skipped | completed
tech_stack:
  - python
  - fastapi
rules:
  - No print statements in production code

CLI Commands

know init [DIRECTORY]

Create a default .context.yaml in the specified directory (defaults to current directory).

know status [--fail-on-drift]

Analyze git changes against your active context. Shows a MATCH (green) or DRIFT (red) panel. Use --fail-on-drift to exit with code 1 on drift (useful in CI/hooks).

know update

Quick-edit your .context.yaml from the command line:

  • --task TEXT — set current task description
  • --task-id TEXT — set task ID
  • --task-status [active|skipped|completed] — set task status
  • --add-rule TEXT — append a rule
  • --add-goal TEXT — append a goal

know hook install

Install a git pre-commit hook that runs know status --fail-on-drift before each commit.

know hook uninstall

Remove the pre-commit hook. Restores any backed-up hook.

Project details


Download files

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

Source Distribution

knowhook-0.1.0.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

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

knowhook-0.1.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file knowhook-0.1.0.tar.gz.

File metadata

  • Download URL: knowhook-0.1.0.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for knowhook-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ab66c21f2eb3888e4df1bef89aa6bcfa989d5d0a195e7a48accf034b018a8288
MD5 65674ae9551ccff9d65d88d781765a82
BLAKE2b-256 1b443d3bf4a57b480acf8bdc26030541b1158333c92e31735d79e676a7a48bca

See more details on using hashes here.

File details

Details for the file knowhook-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: knowhook-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for knowhook-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b72cab14bb69b52e54d73302521de1d6fa92d1b9cb5d3f9a81de80058fab857a
MD5 7178620f32c9ff583e43fbbe37f9b912
BLAKE2b-256 97271f8488a37d3cd72e429e414bc2c104e0451e33dffac3384300f814297bac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page