Arrow to go next
All posts

End Context Engineering Hell: Introducing the Flux Framework

Carver Agents FLUX logo with neon green pixel-style typography and tagline ‘Compound Engineering Framework for AI Agents’ on a dark grid background.

AI coders aren't held back by models. They're held back by context engineering hell: hand-maintaining context memory files, re-explaining your repo every session, and watching institutional knowledge evaporate between branches. We built the Flux framework to fix the operational layer. It turns ad-hoc AI coding into session-based, Git-native workflows that auto-prime the model with the right code, docs, and prior lessons, track decisions as you work, and synthesize durable learnings when you're done - so the next session starts smarter by default. The result is less librarian work, fewer repeat mistakes, faster onboarding, and a development loop where your team's hard-won fixes actually compound over time.

Check out this 3-minute video on Flux Framework

Why this exists (and why now)

AI coders are powerful—but we've been propping them up with manual context engineering:

  • You curate brittle memory files (e.g., CLAUDE.md) and hope the model reads them.

  • Every "remember this next time" (design patterns, gotchas, env quirks) is a manual update.

  • Git is loosely coupled to model activity; what happened in a session gets lost between branches.

  • "Institutional knowledge" decays; each session starts from scratch; nothing compounds.

That treadmill taxes your best engineers, slows onboarding, and makes repeated mistakes feel inevitable. The problem isn't the models - it's the operational layer around them.

The Flux addresses the shortcomings of the operational layer.

Design goals

  • Zero manual context management: No more babysitting memory files.

  • Git-native: Branch per session; changes tied to a concrete workflow.

  • Compound learning: Problems → solutions → lessons → Startup context for future sessions.

  • Human-in-the-loop: You make design calls; the system handles the boring, repeatable parts.

  • Agent-friendly: Works out of the box with Claude Code; easily adapted to other agents.

What the framework does

Flux replaces ad-hoc prompt rituals with learning-focused sessions: you start with a session goal, the framework primes the model with the right code/docs/lessons, spins up an isolated Git branch, tracks progress as you work, and on completion synthesizes lessons into durable org memory.

Your very next AI-coding session starts smarter - as if by magic (spoiler, it's not magic).

Session Start

  → Context Priming

  → Development Work (human + AI)

  → Updates (progress, git, decisions)

  → Completion

  → Knowledge Synthesis (lessons, docs index)

Model context priming

Each session begins with the goal, which the framework parses to pinpoint the relevant domains in your codebase. It then discovers the pertinent files, pulls in the right documentation and historical lessons, and automatically spins up an isolated Git branch for the work. With that, the model is primed with exactly the context it needs—no manual memory-file wrangling, no copy-paste rituals.

Continuous progress tracking

As you build, the system records what actually happened: code changes, decisions taken, and the challenges you hit along the way. It captures insights and emerging lessons in-line with the work, while keeping tabs on Git status and task completion so your progress stays auditable and easy to resume.

Knowledge synthesis & storage

When you wrap, the framework generates a comprehensive session summary and promotes the new insights into project/org memory. Documentation gets richer with each pass, reflecting the improved understanding from the session. The net effect is a repo that "remembers", so future sessions initialize with stronger starting context and fewer repeated mistakes.

Quick start

Works today with Claude Code; porting to other agents is mostly path/wrapper changes.

  1. Install commands

git clone https://github.com/carveragents/flux.git

cp -R flux/commands ~/.claude/

  1. Start a session

/session:start fix memory leak in data processing

  1. Work & capture progress

/session:update

  1. Synthesize knowledge

/session:end

- Produces a comprehensive session summary.

- Updates (or creates) `docs/LESSONS.md` with deduped, structured learnings.

- Builds/updates `docs/README.md` as a navigational index.

- Clears the active session pointer.

How it works (by command)

/session:start

  • Derives a session_name from your goal (e.g., feat-auth-refactor).

  • Reads docs/README.md and docs/LESSONS.md (if present) to prime the model.

  • Creates and checks out a new Git branch.

  • Writes .claude/.sessions/<YYYY-MM-DD-HHMM>-<session_name>.md and marks it current.

/session:update

  • Appends a compact update: summary, git changes (--porcelain), task counts, issues, solutions.

/session:end

  • Emits a detailed session report: duration, changed files, commits, todos, accomplishments, breaking changes, deps, deploy steps, lessons learned, tips for future devs.

  • Creates/updates docs/LESSONS.md → merges new learnings with existing ones (no duplicates).

  • Creates/updates docs/README.md → a pointer index to everything in docs/, never duplicating content.

  • Clears .claude/.sessions/.current-session.

Git helpers (optional)

  • /git:commit:Conventional commits + emoji, suggests splitting logically distinct diffs.

  • /git:merge-cleanup:Merge current branch to main, push, and clean up.

Example: fixing a memory leak (end-to-end)

Start:

/session:start fix memory leak in data processing

- Branch: `bugfix-memory-leak-data-processing`

- Context: loads relevant data-processing files, prior lessons on memory/streaming (if any exist in the project documentation/memory files).

Development phase (with updates):

- You (human + AI) do the work as usual

/session:update

Update – 2025-09-24 14:40

Summary: Replaced list accumulation with generator-based streaming in the pipeline.

Git Changes:

  • Modified: src/pipeline/process.py, src/pipeline/io.py

  • Current branch: bugfix-memory-leak-data-processing (commit: abc123)

Todos (2 completed, 1 pending):

  • Replaced accumulate() with stream()

  • Added regression test for large file

  • Verify peak RSS on production dataset (pending)

Issues and Solutions:

  • Issue: Peak memory spikes on large CSVs.

  • Solution: Implemented chunked read with iterator transform; removed accidental caching.

End:

/session:end

Generates a full summary and updates:

  • docs/LESSONS.md (deduplicated):


    • Use streaming iterators for large datasets; avoid accidental list materialization.

    • Chunk I/O and avoid hidden caches in helpers.

    • Add load-tests to catch regressions.

  • docs/README.md:


    • Adds pointers to the updated lesson and any new documentation created.

Next time anyone starts a session touching data pipelines, the relevant lessons are automatically surfaced at /session:start.

Why compound engineering beats memory files

Problem (today) Flux Framework
Manual context memory upkeep Auto-primed from current docs + accumulated lessons
Ad-hoc link to Git Branch per session; progress tied to repo state
Knowledge evaporates End-of-session synthesis updates LESSONS.md and README.md
Repeated gotchas Lessons are re-surfaced at the start of relevant sessions
Onboarding is slow New devs start with curated prior art for the exact goal

Under the hood

flux/

├── README.md

├── LICENSE

└── commands/

    ├── git/

    │   ├── commit.md

    │   └── merge-cleanup.md

    └── sessions/

        ├── current.md

        ├── end.md

        ├── help.md

        ├── list.md

        ├── start.md

        └── update.md

Key implementation details

  • Files it reads first: docs/README.md, docs/LESSONS.md (if present).

  • Docs index: docs/README.md is a pointer map, not a dumping ground.

  • Lessons pipeline: merges new learnings from the session summary into docs/LESSONS.md without duplication.

  • Safety: .current-session is cleared (not deleted) on session end to avoid accidental orphan states.

  • Commit hygiene: /git:commit inspects diffs and session context to ensure atomic commits.

Extending beyond Claude Code

All logic lives in the ‘command contracts’ (commands/.../*.md). To adapt:

  • Map ‘allowed tools’ and filesystem paths to your agent/runtime.

  • Keep the ‘session file format’ stable for portability.

  • If your agent can run shell steps, branch creation and git status work as-is.

Next steps

  • Editor integration: Today it’s command-driven; deeper IDE hooks are a great way to accelerate usage.

  • Heuristics for “relevant files”: Currently doc-priming; code-awareness can be expanded (e.g., dependency graphs, call graphs).

  • Org-level memory: docs/LESSONS.md is repo-scoped; multi-repo knowledge roll-ups are a natural next step.

  • Multi-agent orchestration: Single-agent by default, but pluggable with other agents is encouraged.

Get Started!

If you're tired of context engineering hell and want compounding AI-assisted development, try Flux on your next task.

GitHub Repo + Quick Start: Flux Framework

References & inspiration