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.1.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.1-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: knowhook-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 740a5b9477464e6d4781886e02d24c45418cfde2450147b5b8da344e3cc41cc4
MD5 945c825a22b52806bb0babf2140f91b8
BLAKE2b-256 ff299a21e764117d696ea9dc0d835a108e47fd05731e786468502628694f68bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: knowhook-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b20bf7d13dffafd700154796a37f3e9105e8d8fc33cb3f40791dcc7608869270
MD5 ea257c3beb3ff3c444e114f51cb7f00c
BLAKE2b-256 4dfe9ee5dac026e6ee1f0d6abeae13e3eef52e42005d3323d505bd975def0808

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