Agentic Monocontext MDE

Agentic
Monocontext
MDE

A context catalogue framework that stores project knowledge as typed, scoped and evidence-backed items in a local SQLite database. Serves task-relevant subsets to AI coding agents via an MCP server under a configurable token budget.

Invariant
A rule that must always hold.
Decision
An architectural choice with rationale.
Contract
An interface spec between components.
Module Note
What a module does and how.
Build/Test Instruction
How to build, test or run the project.
Tool Permission
Tools and actions permitted or denied per agent role.
Context Slicing
Deterministic 5-Step Algorithm
01Infer relevant files from the task description.
02Select items whose scope overlaps those files.
03Invariants and Tool Permissions are mandatory. Contracts high priority. Decisions medium. Notes and Build instructions lower.
04Rank by scope specificity, keyword overlap and recency.
05Pack items in priority order until the token budget is reached.
OCL Validation
5 Well-Formedness Constraints
01Every Invariant needs at least one evidence link with a verification method.
02Every Tool Permission must attach to a role with a non-empty scope.
03Every Contract must reference a concrete interface location with evidence.
04Every scoped item must record a lastVerifiedCommit.
05No role may have conflicting permissions on overlapping scopes. Rejected on write.
Drift Detection
Repository Staleness Checks
Does the scope glob resolve to at least one existing file?
Do all evidence links still point to real files or URLs?
Is lastVerifiedCommit still an ancestor of HEAD?
Failed items are marked drifted. They stay in context packs but carry a warning.
Conformance Monitoring
Runtime Breach Detection
Scope breach when an agent edits a file outside all permitted scopes.
Tool policy breach when an agent invokes a denied tool.
Invariant breach when an agent edits a file within an invariant's scope.
Violations are logged to the database for audit.
MCP Server Tools
7 JSON-RPC Tools via stdio Transport
context_upsertAdd or update a context item
context_deleteRemove a context item
context_validateRun OCL constraint checks
context_searchQuery by type, scope or keyword
context_sliceTask-specific context pack
context_driftDetect stale or broken items
context_statusCatalogue health metrics
Evidence & Scopes
Core Structural Concepts
Evidence Links
Normative items (Invariants, Contracts) must be backed by evidence: a file path, test name or URL. Each link has a verification method (file exists, test passes, hash match or manual review).
Scopes
Every item carries a glob pattern like src/auth/**. Scopes determine which parts of the codebase the item applies to and control selection during slicing.
Class Diagram
Scroll to zoom · Drag to pan · Esc to close
Experiment Logs
Baseline vs Treatment
Loading logs…