Logo A-Modular-Kingdom

A-Modular-Kingdom

Cộng đồng
MasihMoafi

A Codex-based coding-agent TUI with explicit context control, auditable Smart Prune, and local session continuity.

Nhà phát hànhMasihMoafi
Kho mãElpis
Ngôn ngữRust
Bản fork
2
Sao
44
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépApache-2.0
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    A-Modular-Kingdom cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    44 sao và 2 bản fork từ kho mã được liên kết.

Never lose a thread again.

You run an agent inside Elpis, and it becomes Elpis.

Elpis is an open-source fork of OpenAI's Codex CLI that keeps the proven execution foundation while adding explicit context control, durable continuity, auditable pruning, and provider-neutral ownership around the model loop.

Linux verification License Telemetry

Install • Features • Evaluation • Docs

Elpis v0.2.0 is available for Linux x86_64. Start with the versioned guide or interactive demo. The accepted release passed its exact-source shipping checks. The release tag, not this development branch, identifies the shipped runtime.

Elpis walkthrough — launch, Context Ledger, and Smart Prune admission

The admission flow — Smart Prune scanning a completed tool result before the main model sees it (illustrated with fixture data, not a captured session).

Elpis startup, Elpising, streaming text, and Context Ledger animations — development widget captures

Context breakdown in dark mode, with distinct category colors and visible free capacity

The same context breakdown in light mode

Elpis Context Ledger with matching category colors and the Quiet Rail composer

September 9 development preview · local visual updates to UI commit 40838f83. Native Rust widget captures with illustrative session data: matching context colors, visible unused capacity, readable Elpising motion, startup dissolve, and coalescing responses. These changes are newer than the September 5 v0.2.0 release; the screenshots are not a promise that the release contains them.

Contents

Quickstart

Linux x86_64; macOS and Windows are not included in v0.2.0. Review the installer before running it:

bash
curl -fsSL https://raw.githubusercontent.com/MasihMoafi/Elpis/v0.2.0/scripts/install-elpis.sh | bash && ~/.local/bin/elpis

The installer downloads the latest published Elpis Linux binary and verifies its SHA-256 sidecar. RTK is an optional, separate shell-output filter; this installer does not install it. On first launch, choose a provider and sign in or enter its API key.

v0.2.0 is the current release.

What is Elpis

Elpis is a provider-neutral coding-agent environment. The selected model or runtime performs inference; Elpis owns the surrounding working state: context admission, continuity, memory, permissions, tools, evidence, and the terminal interface.

It starts from OpenAI's Apache-2.0 Codex CLI and preserves its execution foundation — terminal UI, patches, permissions, sandboxing, sessions, and tool lifecycle — while adding a continuity- first control layer around it. Change the provider without throwing away the project context. Nothing about the project has to be explained twice.

Different paths. Same roots. One shared project.

Why Elpis

Long sessions fill up with transcripts, file reads, searches, command output, and dead ends. The useful state gets buried in the story of how the agent reached it, while every request pays for more context.

Agents using excessive tool calls and tokens to gather redundant context

Elpis separates the active working set from durable evidence. The next request receives a small, inspectable context; the exact record stays on disk and can be retrieved when it is needed.

Three paired configured historical runs with automatic pruning enabled under the superseded high-frequency setup used one byte-identical prompt, the same model, and the same source commit on both arms. In those runs, peak context per request fell 47–65%; median context stabilized at 26.6–27.1%. Codex peaked above 90% of the window in each run, while Elpis stayed safely bounded in the green zone.

Elpis never modifies a model's own output or a request already in flight. Pruning rewrites only harness-supplied tool output, using a separate model instance sequenced against the main agent.

Core Features

Context engineering

Context is a budgeted working set, not a dumped transcript. Elpis makes admission visible and uses a layered pipeline to keep useful findings while removing disposable exploration:

Elpis Context Architecture

LayerWhat it doesWhen
1. RTK shell-output filteringCompacts supported command output before it reaches the model.Before the agent sees it
2. Deterministic safety capBounds exceptionally large tool results. This is inherited from Codex.Before the agent sees it
3. Smart Prune — ExperimentalOptimizes eligible fresh tool results before the main model's first exposure to them. Once admitted, Smart Prune does not revisit that history./prune enables it for subsequent turns; /force-prune <1-100> remains an explicit one-shot action that may reduce prompt-cache reuse

/prune enables Smart Prune (the ACE pruning layer) for subsequent turns without rewriting already-sent history. /force-prune <1-100> is an explicit emergency action that may reduce prompt-cache reuse. /compact immediately runs Codex native compaction, independent of Smart Prune. Automatic native compaction uses the model-window threshold and usable-window headroom. Smart Prune is Experimental and off by default; /settings saves its value for the next conversation.

Ace pruning lifecycle from a retired automatic threshold-triggered configuration

This diagram illustrates the automatic, threshold-triggered pressure-cycling configuration used in the historical evaluation runs below — retired, and not current default behavior. Current Smart Prune optimizes a fresh tool result once, before its first admission, and never revisits already-sent history the way this sequence shows.

Historical emergency-pruning example

Task 1 Context Flow and Pruning Lifecycle

From a configured historical run with automatic pruning enabled under the superseded high-frequency setup (42 passes shown here; not current default behavior). One real pass from disk. A search command whose raw output ran to 18,930 characters — close to 5,000 tokens carried across requests:

Before — what the model was carrying:

text
Script completed · Wall time 0.1 seconds · Output:

tui/src/external_agent_config_migration.rs:800:   item_type: …ItemType::AgentsMd,
tui/src/external_agent_config_migration_flow.rs:75: …ItemType::AgentsMd
tui/src/theme_picker.rs:283:  fn theme_picker_subtitle(home: …) -> String
tui/src/theme_picker.rs:392:     subtitle: Some(theme_picker_subtitle(
tui/src/theme_picker.rs:605:     let subtitle = theme_picker_subtitle(…, Some(200));
tui/src/theme_picker.rs:617:     let subtitle = theme_picker_subtitle(…, Some(140));
tui/src/app_event.rs:152:        OpenAgentPicker,
… roughly two hundred more lines of the same shape …

After — what the model carries on the next request:

text
[Ace pruned 231 lines of ripgrep output (18,930 chars → 248 chars).
Findings:
- Found ItemType::AgentsMd in external_agent_config_migration.rs:800
- Found theme_picker_subtitle definitions in theme_picker.rs:283,392,605,617
- Full raw output preserved in rollout evidence: rollout://sess-01j8/tool-14.log]

Context Ledger and observability

The Context Ledger (Tab; during an active turn, Alt+C always toggles it) lists admitted goals, rules, memory, and other portable sources with their byte sizes and capped character-derived estimates. Toggling a row writes admission.toml, which controls what the next turn receives.

Development rules are ordinary Markdown Ledger rows, not skills: newly discovered rules start included and an explicit exclusion persists. A nonempty configured development-rule root list replaces the managed fallback; an empty list uses it. Elpis leaves ordinary and bundled skills off by product default, while deliberate user configuration can enable a selected skill. Enabled skills expose compact metadata and keep their bodies lazy; /skills shows available candidates and their origins, but mentions and the model-visible list contain enabled skills only. The Ledger has no skills-catalog token row; its per-source estimates are not tokenizer measurements.

Current Context Ledger with distinct amber and pale-yellow source rows

In v0.2.0, Ledger and /context share category colors and a full-window scale. They distinguish active context usage from locally estimated request categories: user and agent messages, reasoning, tool calls/results, instructions, developer messages, and tool definitions. Category estimates are not provider-billed counts. Available backtrack checkpoints and local evidence links remain inspectable.

Earlier category-view capture; this image is retained to explain /context, not the September 9 appearance.

Live session dashboard

/dashboard opens a local HTML view in your browser — no transcript content leaves the machine. It gives the same context and token accounting as the Ledger and /context, plus what a turn is doing right now and, when Smart Prune (the ACE pruning layer above) is on, its admission and optimizer-cost accounting:

The September 9 development dashboard also supports authorized pruner settings edits. The captures below use the checked-in illustrative fixture, with preview settings disabled. Their counters are demonstration data, not experiment results.

Current dashboard Activity tab

Current dashboard Context tab

Current dashboard Tokens tab

Current dashboard Smart Prune tab, including incomplete usage and timeout evidence

Sessions and continuity

Keep the working context across model switches, compaction, and restarts:

  • GOAL.md holds the current task. It is carried into each request, stays visible across compaction, and is editable during a run.
  • ES.md is an event-derived executive summary. It records modified files, commands run, blockers, and next steps, and is updated as the run progresses.
  • Exact resume continues an existing thread with its full history, using the provider-native session when one is available.
  • Lean continuation starts a clean thread from the current GOAL.md, ES.md, and active rules. This sheds old exploration without losing the objective.

Memory

Durable memory is one Markdown file, MEMORY.md, in the Elpis memory directory (derived from CODEX_HOME). The Context Ledger discovers it and lists it as a row, switched off until you admit it: like every optional row, memory does not reach the model unasked.

  • One visible file. Plain text. Read it, edit it, commit it to git, or delete it.
  • Admitted in the open. Because it is a Ledger row, you can always see whether memory reached the model, switch it on when you want it, and drop it when you do not.
  • Retrieval beyond that file is your choice. Register an MCP server — for example rag-mcp — and Elpis will use it.

Elpis previously ran an extraction, consolidation, and promotion pipeline. It was removed because it did not work: across two threshold settings it produced zero durable promotions, every sweep landing one recall short of the gate. Memory that rewrites itself in the background without appearing anywhere is the failure mode the Ledger row exists to prevent.

Deterministic work graphs

A coordinator can fan work out to several agents under an engine that validates the plan before anything runs. This is Elpis's own; it is not part of the Codex foundation.

Elpis deterministic work graph

The coordinator submits a complete task graph — tasks, dependencies, write scopes, acceptance criteria, and environments. Elpis then owns the scheduling:

  • Cycles cannot be scheduled. Kahn's topological algorithm proves the graph is acyclic and rejects it otherwise, so no worker is created for a plan that could only deadlock.
  • Write conflicts are caught by construction. Path-prefix intersection detects overlapping write scopes, and all writable tasks in one environment are serialized even when their declared prefixes do not overlap.
  • Verification is not optional. A writable task without a directly dependent verify task in the same environment is rejected before dispatch.
  • Evidence gates progress. Dependent work is released only after an accepted result; a failed, cancelled, or blocked prerequisite blocks its descendants.

Elpis never creates, merges, rebases, deletes, or pushes branches or worktrees. Preparing and integrating them stays coordinator-owned, because those operations change durable user state and deserve deliberate review.

Off by default. Enable with enable_fanout = true under [features]; there is no slash command. Full rules and the graph schema are in docs/WORK_GRAPHS.md.

Bring your own provider

Elpis is not tied to a single model vendor:

  • OpenAI: GPT-4o, GPT-5.6-Luna, o1, o3, and compatible endpoints.
  • Anthropic: Claude 3.5 Sonnet, Claude 3 Opus, Claude 3.5 Haiku.
  • Google: Gemini 2.0 Flash, Gemini 1.5 Pro.
  • Local & self-hosted: Ollama, vLLM, and any OpenAI-compatible server.

Switch models mid-session without restarting. The working context, goal, and session memory are preserved across provider boundaries.

Integrations and tools

Extend Elpis with external capabilities that stay in their own processes through MCP:

  • Workspace retrieval: rag-mcp provides local LanceDB/Tantivy search over your documents.
  • Voice transcription: WhisperType provides local speech-to-text without adding its model/runtime dependencies to Elpis core.

Privacy and ownership

Telemetry is off by default and no analytics are uploaded unless you explicitly configure an exporter. Bring your own provider keys. Durable Elpis state is local files and SQLite that you can inspect, edit, export, or delete.

Evaluation status

Evidence reviewed September 9, 2026. RQ1, RQ2, and RQ5 below describe historical evaluations. RQ4 includes the newer frozen-build cost study: 61 accepted pairs in 17 batches. Neither study benchmarks the latest UI binary. See the content and evidence audit.

The historical evaluation reports three paired, byte-identical configured workloads on gpt-5.6-luna (258,400 token context window), using a superseded high-frequency pruning setup. These runs share a workload and do not establish general task quality.

RQ1: Context Reduction & Operating Hygiene

Across those configured historical runs, Elpis maintained working sets within safe operational thresholds.

Peak Context Utilization

In those configured historical runs, Codex expanded into the critical danger zone (>90% window) in every run, forcing 3 emergency compactions. Elpis maintained peak window utilization at 32.5–49.5%, achieving a 47–65% reduction in peak context footprint:

Peak Context Window Utilization (Elpis vs. Codex)

Input Token Distribution & Interquartile Stability

In those configured historical runs, Codex suffered wide distribution variance as transcripts accumulated, while Elpis tightly stabilized median token input at 68.8k–69.6k tokens (26.6%–27.0% of the window):

Input Tokens per Model Call (Interquartile Range & Median across 3 Runs)

Trajectory Dynamics across Context Health Bands

When normalized across the recorded request lifecycle (0% to 100% completion), the historical Codex trace grows toward emergency rollover. The Elpis trace shown here uses automatic pruning under the superseded high-frequency setup; it is not current default behavior:

Normalized Task-Progress View (0%–100% Sequence Overlay)

Operating Zone Breakdown

Across those configured historical requests, Elpis spent over 95% of its operating lifespan inside the safe and healthy bands, with zero requests entering the critical danger zone:

Context operating zones by run

RQ2 & RQ3: Target Retention & Task Quality

  • RQ2 (Information Retention): In benchmark audits testing recall of key file paths, schemas, and error signatures after pruning, 100% of tested targets (6/6) were retained intact in active context.
  • RQ3 (Task Performance): Not established. The executed runs are incomplete and unreplicated, so they do not support a comparative correctness claim in either direction. No per-arm score is reported, and there is no evidence that pruning improves task completion or output quality.

RQ4: Pruning Overhead & Token Economics

The September 9 cost study measures fresh-output admission on frozen binary d58e8c9b8861, using synthetic fixtures. Costs include main-agent and optimizer usage, priced at recorded September 8 rates; they are estimates, not invoices. Cache-hit fractions were observed, not controlled.

Requests per sessionOptimizer effortAccepted pairsEstimated cost change vs. off
3Max8+162.5%
3Medium5+41.4%
3Low8+54.5%
3None8+24.8%
11Low8−3.0%
35Low8 across two batches−9.8%
35None8−20.9%

Current study: cost and token changes by optimizer effort on short sessions

Current study: cost and token changes by request horizon

Longer runs can amortize optimizer cost; short runs cost more in these fixtures. The two Low/35 batches are a descriptive aggregation, not a pooled significance claim. A separate None-effort multi-file probe failed exact citation fidelity. Timeouts, stalls, format misses, and exclusions remain in the full report. These results do not establish real-repository task quality or universal savings. The chart data and provenance are regenerated from the recorded metrics by python3 scripts/refresh-public-evidence.py.

Historical overhead, retained for comparison:

Pruning adds an auxiliary model call sequenced against the main agent, and rewriting history invalidates the provider's cached prefix. Both costs are real. The figures below are configured historical runs with automatic pruning enabled under the superseded high-frequency setup; they bound that configuration's penalty rather than describe the current default: 730,810 auxiliary tokens spent to reclaim 605,377 context tokens (0.83 reclaimed per spent token).

What Pruning Spent to Hold That Window (41-Pass Breakdown)

RQ5: Forensic Auditability

Every pruning event produces an immutable audit record on disk under ~/.elpis/logs/pruning/. In full forensic reconstruction evaluations, 7 of 9 properties were completely recoverable from disk, 2 partial, and 0 absent.

Research QuestionEmpirical Finding
RQ1 — Context EfficiencyHistorical superseded high-frequency setup: peak reduction of 47–65%; median context stabilized at 26.6–27.0% of the 258k window.
RQ2 — Information Retention6/6 tested post-prune targets preserved intact (100% retention).
RQ3 — Task PerformanceNot established. The available runs do not support a comparative correctness claim.
RQ4 — Pruning EconomicsFrozen synthetic study: short sessions cost more; longer sessions can cost less. Quality and general savings remain unproven.
RQ5 — Forensic AuditabilityHistorical audit: 7/9 properties fully recoverable, 2 partial, 0 absent properties.

Current UI verification

The other implementation agent's September 9 report records 127 focused passing tests covering motion, startup, streaming, the ledger, and status; native frame exports and an installed PTY smoke check also passed according to that report. This content audit did not independently rerun those UI checks. This is scoped regression evidence, not a clean full-suite claim: pre-existing suite failures remain. The cost/pruning calculators passed 18 tests, and all 17 cost batches reproduced from the archived records without a discrepancy. See the audit for the separate build identities, test scope, chart provenance, and public-content checks.

Documentation

License

Apache-2.0.

The execution foundation — terminal UI, patches, permissions, sandboxing, and sessions — derives from OpenAI's Apache-2.0 Codex CLI. Elpis extends that foundation with context admission and pruning, continuity checkpoints, auditable evidence, and provider control. Codex-derived source retains its upstream notices under codex-rs/.

Cài đặt

TypingMind
{
  "mcpServers": {
    "elpis": {
      "command": "python",
      "args": [
        "src/agent/host.py"
      ]
    }
  }
}

Dùng MCP A-Modular-Kingdom với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối A-Modular-Kingdom, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm A-Modular-Kingdom làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của A-Modular-Kingdom.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "elpis": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của A-Modular-Kingdom, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của A-Modular-Kingdom.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng A-Modular-Kingdom giúp tôi làm việc này không?
A-Modular-Kingdom
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng A-Modular-Kingdom.

Câu hỏi thường gặp

Máy chủ MCP A-Modular-Kingdom dùng để làm gì?

A-Modular-Kingdom là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP A-Modular-Kingdom với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng A-Modular-Kingdom với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP A-Modular-Kingdom với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối A-Modular-Kingdom, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP A-Modular-Kingdom với TypingMind?

A-Modular-Kingdom hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP A-Modular-Kingdom cung cấp những công cụ nào trong TypingMind?

A-Modular-Kingdom cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP A-Modular-Kingdom không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu A-Modular-Kingdom yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇