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.2.tar.gz (29.1 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.2-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: knowhook-0.1.2.tar.gz
  • Upload date:
  • Size: 29.1 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.2.tar.gz
Algorithm Hash digest
SHA256 dbbcccea6e96a496ea94b41522aede17ba97e73973d7c54e5843434a1459b436
MD5 a646b2b6e0f10ec910bd1493e0e4be03
BLAKE2b-256 300c0553a4fda0149dbf58117dafc0b8cbbdcef2160b004326b50cb17f0bc632

See more details on using hashes here.

File details

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

File metadata

  • Download URL: knowhook-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4f260e9396e10a5f5857a9631f78ac0253c48118935a7cf8275dee260caf42d4
MD5 b9a72899182924aa666f3c0fc796bc3a
BLAKE2b-256 f6ee5eae3733ddb4d17d436c58dab3f753c619d730904aba5b5b45ccd85eef51

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