r/ContextEngineering • • 17h ago

I built PromptPump: a local CLI that turns a one-line request into a structured, repo-aware prompt (Ollama, no API keys)

Thumbnail
gallery
5 Upvotes

Hey everyone, I've been working on PromptPump, an open-source CLI that takes a short request and compiles it into a structured, context-rich prompt you can paste into any AI assistant. It runs 100% locally on Ollama, so there are no API keys and your prompts and code never leave your machine.

The problem: A request like "add a pause menu" or "a fox in a snowy forest" leaves a lot unspecified. A good prompt needs structure (role, objective, constraints, output format) and context (what your project actually looks like). Writing that by hand every time is slow, so most of us skip it.

What it does

promptpump run "add source citations to each RAG answer" --stack fastapi
  • Three modes: code, image, and content (stories, scripts, articles). Each has its own schema. Code covers role, measurable objective, success criteria, scope, and output format. Image covers subject, style, composition, and lighting. Content covers audience, structure, voice, and boundaries.
  • Repo-aware code prompts: for ongoing projects it scans your workspace and injects the file tree, key files, and a symbol outline (Python via ast; JS/TS and Go via regex), packed into a token budget by BM25 relevance to your request. It tells the model to reuse existing functions instead of reinventing helpers.
  • Grounding and validation: the context section is overwritten with deterministic scan facts, and the output is checked for unsupported file or function references. Missing sections trigger a repair attempt, and unknowns are listed under "Assumptions (verify before coding)."
  • Stack profiles: 60+ built-in rule sets (FastAPI, Django, React, PyTorch, Docker, and more) that you can combine with --stack.
  • Safe by default: respects .gitignore, never reads .env, keys, or credentials, doesn't follow symlinks, and makes no network calls except to your Ollama server.
  • Transparent: --dry-run shows exactly what the model would receive, and --stats shows the token budget and the input reduction versus pasting the whole repo.
  • Built-in telemetry: promptpump telemetry measures TTFT, tokens/sec, and peak GPU memory on your hardware.

Does it actually help? Honest answer: early signal, not proof. I ran a small pilot with three synthetic Python tasks, one generation each, all on qwen2.5-coder:7b, scored by pytest:

Raw requestFull repo dumpPromptPump
Tasks passed0/32/3

That's far too small to claim a general quality win, so I'm treating it as a hypothesis. The benchmark harness, fixtures, and raw results are in the repo if you want to poke holes in it or add tasks.

Hardware note: it runs fine on modest machines. On my 6 GB RTX 3050 laptop, the 7B model decodes at about 18 tokens/s, while a 14B model spills to CPU and drops to about 3 tokens/s.

Install

pipx install promptpump
promptpump doctor

Python 3.10+ and Ollama required. MIT licensed.

GitHub: https://github.com/RiteshNipane/PromptPump

I'd love feedback on the prompt schemas, what stack profiles or benchmark tasks to add, and whether the repo-context approach holds up on your projects. Happy to answer questions.


r/ContextEngineering • • 1h ago

Release: The Agentic Collaboration Framework (ACF) and Intelligent Context Management (ICM), on an OpenCode v2 fork (MIT)

2 Upvotes

Context compaction is an event that injures an agent's understanding. Each compaction loses detail, and the agent has to recover from it. Repeat it and the loss compounds.

Intelligent Context Management (ICM) replaces compaction. The working agent assesses what it needs for the work ahead and why, then keeps material verbatim, distills tool output, compresses finished work, releases what no longer serves, or leaves its context as it is. Edits change what the model sees, not the saved history. ICM selects content itself only for model input limit overflow protection.

ICM is part of the Agentic Collaboration Framework (ACF), a multi-agent framework for long-horizon work that spans many sessions, where a problem has to be modeled before it can be solved. You work with one primary agent, the Principal. It delegates to Partners, Associates and Assistants, and checks and integrates their work against its working-model, its evolving model of the problem. ACF's instructions are protocols that agents enact as processes, not a rule for each case.

Both run on acf-opencode, our fork of OpenCode v2. Upstream OpenCode v2.2.5 had no place to keep a context plugin's decisions with the session; the fork adds an API that keeps them and applies them whenever the session's history is loaded for the model. It also adds a session Interlink tool, so Principals in different sessions can message and task each other.

The ICM README describes the system, includes an exploratory replay study with its limits, and says what hasn't been measured: https://github.com/DefendTheDisabled/intelligent-context-management

ACF: https://github.com/DefendTheDisabled/agentic-collaboration-frameworkContext compaction is an event that injures an agent's understanding. Each compaction loses detail, and the agent has to recover from it. Repeat it and the loss compounds.

Intelligent Context Management (ICM) replaces compaction. The working agent assesses what it needs for the work ahead and why, then keeps material verbatim, distills tool output, compresses finished work, releases what no longer serves, or leaves its context as it is. Edits change what the model sees, not the saved history. ICM selects content itself only for model input limit overflow protection.

ICM is part of the Agentic Collaboration Framework (ACF), a multi-agent framework for long-horizon work that spans many sessions, where a problem has to be modeled before it can be solved. You work with one primary agent, the Principal. It delegates to Partners, Associates and Assistants, and checks and integrates their work against its working-model, its evolving model of the problem. ACF's instructions are protocols that agents enact as processes, not a rule for each case.

Both run on acf-opencode, our fork of OpenCode v2. Upstream OpenCode v2.2.5 had no place to keep a context plugin's decisions with the session; the fork adds an API that keeps them and applies them whenever the session's history is loaded for the model. It also adds a session Interlink tool, so Principals in different sessions can message and task each other.

The ICM README describes the system, includes an exploratory replay study with its limits, and says what hasn't been measured: https://github.com/DefendTheDisabled/intelligent-context-management

ACF: https://github.com/DefendTheDisabled/agentic-collaboration-framework


r/ContextEngineering • • 14h ago

Long-Term memory structure

Post image
2 Upvotes

Posted originally in r/EverMindAI


r/ContextEngineering • • 10h ago

Workflow folks: how do you prove a run actually finished the job, not just finished green?

1 Upvotes

I used to trust the green check way too much. A scheduled workflow of mine would finish clean, no errors anywhere, and I would move on. Then one morning I opened the destination out of boredom and found a chunk of the items just were not there. The run had not failed, exactly. It had done most of the job and quietly skipped the rest, and the success status told me nothing about that.

That one cost me a stupid amount of time, because I had to work backwards through days of "successful" runs trying to figure out which ones actually landed and which ones only looked like they did.

I got tired of that, and honestly tired of re-briefing every new run on what the last one did, so I built something to fix that side of it for myself. Not selling anything here. I am just trying to find out whether the checking part is a real problem for other people too, or whether everyone else already solved this and I was just sloppy.

So what do you check beyond the green execution? Do you read back from the destination and compare, count what went in against what came out, run some kind of reconciliation pass later? Or do you mostly trust the status and only dig in when a human complains?

And the partial thing specifically. Has a run ever reported success while only part of the work landed, like most items made it and a few silently did not? What did that cost you when you found it, and how long had it been happening?

One more I keep wondering about. Have you ever broken a run on purpose just to prove your check actually fires? A check that has never failed feels a lot like a hope to me, but maybe I am overthinking it.

What if something handled all of this for you, in the cloud over MCP, so every agent and tool got the same context: decisions, failed attempts, conversations, skills, procedures, tasks. You never touch a file again. Would you guys pay for something that fixes this? Have you ever thought about paying for a tool to manage all of this for you, or has the thought never crossed your mind?


r/ContextEngineering • • 11h ago

The Context Triad: A Unified Framework for Understanding LLM Behavior

Thumbnail github.com
1 Upvotes

The Context Triad is a unified framework for understanding how the placement, subsequent contextual history, and relative support of represented meaning influence language model behavior.

An instruction, definition, constraint, or intended interpretation may remain present and recoverable within a model's context without consistently governing its subsequent behavior.

How does the shape of context influence model behavior?

The Context Triad addresses this question through three primary dimensions, six compound dimensions, and three higher-order dimensions. The accompanying Research Atlas maps existing research, empirical investigations, and engineering practices onto this architecture.

Repository: https://github.com/ArchitecturalGravity/ArchitecturalGravity/tree/main/Research/Context_Triad

The Context Triad

Context Triad

Semantic Locality

The placement and distribution of semantic representations relative to their points of use.

Behavioral influence varies with the position, distance, structural surroundings, and distribution of representations. Greater proximity does not necessarily guarantee greater influence.

Semantic Shadow

The effects of subsequent context and ordering on earlier semantic influence.

Subsequent information can suppress, reinforce, reinterpret, or supersede earlier meaning. Consistency with historical meaning remains distinct from correctness under authorized updates.

Semantic Weight

The balance of coherent semantic support among competing meanings.

Support can accumulate through repetition, elaboration, examples, and paraphrasing. Semantic Weight is distinct from raw token volume, neural network weights, attention scores, and behavioral influence itself.

Quantification and Measurement

DimensionMeasurement Framework
Semantic LocalitySequence distance, normalized position, placement profiles, and position–response functions
Semantic ShadowSemantic-continuation exposure, signed contrasts, order-sensitive comparisons, and matched contextual histories
Semantic WeightSupport proxies, competitive shares, support ratios, absolute support totals, and support–response functions

The framework also develops pairwise and three-way interaction measurements, distinguishing behavioral consistency with a semantic object from correctness under the authorized current state.

Interactive Model

The Context Triad Interactive Model provides an interactive representation of the framework, offering a means of exploring its primary dimensions and the relationships through which contextual configuration shapes semantic influence.

The Extended Context Triad

Extended Context Triad

The Extended Context Triad develops the interactions between the primary dimensions into six regional compound dimensions and three higher-order dimensions, characterizing the persistence, direction, and organization of semantic influence.

Compound Dimensions

DimensionCompositionFocus
Locality ContinuityLocality + ShadowPersistence of influence across changes in contextual distance and placement
Locality ConcentrationLocality + WeightDistribution of coherent support relative to points of use
Shadow ContinuityShadow + LocalityPersistence of influence through exposure to subsequent context
Shadow MomentumShadow + WeightDirectional development of influence through successive contextual exposure
Weight ConcentrationWeight + LocalityOrganization of coherent support across contextual locations
Weight MomentumWeight + ShadowAccumulation of supporting and competing influence through contextual history

Higher-Order Dimensions

DimensionCompositionFocus
AnchoringLocality Continuity + Locality ConcentrationSustained attachment of semantic influence to relevant points of use
TrajectoryShadow Continuity + Shadow MomentumEvolution of semantic influence across successive operations
ConsolidationWeight Concentration + Weight MomentumOrganization and accumulation of coherent support around a common meaning

The six compound dimensions describe three shared pairwise relationships from their respective primary dimensional perspectives.

The complete architecture comprises twelve named dimensions occupying nine geometric positions, representing conceptual relationships rather than independent internal mechanisms.

Behavioral Outcomes and Dynamics

The framework distinguishes between behavioral outcomes and the dynamics through which behavioral influence changes.

Behavioral Outcomes

OutcomeDescription
PreservationMeaning remains behaviorally effective
SuppressionMeaning loses behavioral influence
DisplacementCompeting meaning becomes dominant
TransformationMeaning is reinterpreted or altered in application
ResolutionCompeting meanings are reconciled according to authority and scope

Behavioral Dynamics

DynamicDescription
ReinforcementInfluences strengthen the same tendency
InterferenceInfluences oppose one another
CompensationOne influence offsets another's disadvantage
DominanceOne influence prevails over competitors
RecoveryWeakened meaning regains effectiveness
ReversalInfluence changes direction
SaturationAdditional influence produces diminishing gains
ThresholdSmall contextual changes produce substantial behavioral shifts
InstabilityBehavioral consistency varies across matched conditions

These classifications connect contextual configuration, interaction dynamics, and resulting model behavior.

The Context Triad Research Atlas

Context Triad Research Atlas

The Research Atlas maps 87 external research sources and 14 internal investigations across the framework's dimensional and behavioral constructs, including adjacent research.

It comprises four regional research maps — Locality, Shadow, Weight, and Behavioral — connected through a unified research index.

The atlas synthesizes established findings, related evidence, and applied engineering practices within a common conceptual architecture, without treating conceptual correspondence as independent validation.

Empirical Investigations

StudyTrialsObservations
Glip Preference Anchoring360Selection varied with label, description, position, and rival ordering. The final position was selected in 213 trials.
Fox–Leopard Displacement360Expanding competing support reduced replies without a single selection from 52 to 6, while evidence of pangram identification remained similar.
Planetary Order vs. Greek Genealogy390Permuting the same nine names produced Solar System interpretations ranging from 1/30 to 28/30 replies across scattered layouts.

These investigations provide empirical grounding for aspects of the framework while identifying relationships requiring further controlled investigation and independent replication.

Applications

The Context Triad provides a common framework for understanding model behavior across:

  • Context engineering and prompt sensitivity
  • Long-context evaluation
  • Agentic architectures and persistent task-state management
  • Retrieval-augmented generation
  • Multi-turn instruction adherence
  • Context compression and memory architecture
  • Semantic conflict resolution and model reliability

Across these domains, the framework shifts the analytical focus from the availability of meaning alone toward the contextual relationships that shape its behavioral effectiveness.

Conclusion

The Context Triad unifies the placement, contextual history, relative support, interactions, and behavioral dynamics of represented meaning within a common framework for understanding LLM behavior.

Understanding model behavior requires examining not only what context contains, but how context is shaped and how contextual forces influence represented meaning.

The complete framework, component papers, Research Atlas, interactive model, and empirical investigations are publicly available.

https://github.com/ArchitecturalGravity/ArchitecturalGravity/tree/main/Research/Context_Triad


r/ContextEngineering • • 12h ago

From an MQTT event to document context: a visual RAG workflow

Thumbnail
reddit.com
1 Upvotes

I teach IoT and AI and develop SHAPE, a visual programming environment.

I built a teaching demo where a sensor error received over MQTT triggers a query against a technical manual, rather than requiring someone to open a chat and describe the problem.

The workflow:

  1. Upload a sample sensor manual and prepare it for retrieval.
  2. Receive an MQTT message such as {"errorCode": "E01"}.
  3. Use the error code to query the document-aware service.
  4. Parse the generated response as JSON and publish it back through MQTT.

SHAPE connects the steps with visual blocks. ChordLLM manages documents and retrieval, while Ollama runs Ministral locally. In this example, the manual is attached to one conversation.

The context-design question is what should accompany the error code. The demo uses a single manual, but with multiple devices, the code alone would not identify the right documentation.

Generated troubleshooting steps still need verification against the source, and JSON parsing does not guarantee a valid schema.

How would you scope retrieval in a multi-device setup: separate knowledge bases per device, or a shared collection filtered by device model and manual version?

Code and documentation: https://github.com/TactigonTeam/Tactigon-Shape