Skip to main content

Context Snapshot Generator - Process Refinement System

Generate minimal context snapshots (<500 tokens) for efficient session handoffs and state preservation.

Usage: python context_snapshot.py python context_snapshot.py --save python context_snapshot.py --token-budget 300

Author: CODITECT Process Refinement Version: 1.0.0 Created: 2026-01-02

File: context_snapshot.py

Functions

get_project_root()

Get the project root directory.

ensure_directories()

Ensure required directories exist.

estimate_tokens(text)

Estimate token count (rough: ~4 chars per token).

get_track_summary()

Get compressed summary of track progress.

get_recent_completions(limit)

Get most recent completed tasks.

get_next_priorities(limit)

Get next priority tasks.

get_active_blockers()

Get any documented blockers.

generate_snapshot(token_budget)

Generate context snapshot within token budget.

format_markdown(snapshot)

Format snapshot as markdown.

save_snapshot(snapshot)

Save snapshot to file.

main()

No description

Usage

python context_snapshot.py