Skip to content

CLI Evolution Phase 1: TUI, IDE plugins, KG, mesh, plan, extensions#11

Merged
ApiliumDevTeam merged 92 commits intodevfrom
feat/cli-evolution-phase-1
Mar 5, 2026
Merged

CLI Evolution Phase 1: TUI, IDE plugins, KG, mesh, plan, extensions#11
ApiliumDevTeam merged 92 commits intodevfrom
feat/cli-evolution-phase-1

Conversation

@ApiliumDevTeam
Copy link
Collaborator

Summary

  • Terminal UI — interactive TUI (mayros code) with 30+ slash commands, 3 themes, vim mode, image paste, headless CLI (-p), markdown agents/commands
  • IDE plugins — VSCode extension (sidebar + 4 webview panels) and JetBrains plugin (unified tabbed panel), both via Gateway WebSocket
  • Knowledge Graph — code indexer (incremental TS/JS scanning → RDF), project memory, smart compaction, cross-session recall
  • Multi-Agent Mesh — team manager, workflow orchestrator (3 built-in), agent mailbox, background tracker, git worktree isolation
  • Plan Mode — Cortex-backed semantic planning (explore → assert → approve → execute)
  • Extensions — bash-sandbox, interactive-permissions, llm-hooks, mcp-client, code-indexer, cortex-sync, CI/CD, LSP bridge
  • Hooks — 29 hook types, HTTP webhook dispatcher (HMAC-SHA256), async queue with dead-letter
  • CLIs — trace, plan, kg, workflow, dashboard, session, tasks, mailbox, rules, batch, teleport
  • Security — 18-layer architecture maintained across all new features
  • README — updated with all new capabilities, architecture diagram, extensions table

Test plan

  • pnpm build compiles without errors
  • pnpm test passes (~9200+ tests across 1035+ files)
  • mayros code launches TUI with welcome screen
  • mayros -p "hello" streams response in headless mode
  • VSCode extension packages cleanly (cd tools/vscode-extension && pnpm package)
  • JetBrains plugin builds (cd tools/jetbrains-plugin && ./gradlew build)
  • mayros kg stats returns Cortex graph statistics
  • mayros plan start "test" creates a new plan
  • mayros trace status reports Cortex connectivity
  • mayros workflow list shows built-in workflow definitions
  • README renders correctly on GitHub (tables, code blocks, diagram)

ApiliumDevTeam and others added 30 commits March 3, 2026 16:11
Implement auto-discovery of user-defined slash commands from
.mayros/commands/*.md files with YAML frontmatter for description,
argument hints, and allowed tools. Commands are injected into TUI
autocomplete, help text, and dispatch (default case expands
$ARGUMENTS before sendMessage). Project commands override user
commands with the same name. 24 unit tests.
Implement auto-discovery of agent definitions from .mayros/agents/*.md
files with YAML frontmatter for name, model, allowed-tools, workspace,
and default flag. Agents are merged into listAllAgentEntries() and
resolveAgentEntry() with config agents taking priority over markdown
agents. Project agents override user agents with the same id.
15 unit tests.
Pass ctx.sessionKey through all observability hooks to the TraceEmitter
so every trace event carries its session identifier. This enables
session-scoped querying via DecisionGraph.buildFromSession() and the
new mayros trace session command. All emit methods now accept an
optional session parameter appended to the TraceEvent.
Register two new built-in subcommands in register.subclis.ts:

- mayros trace: query, explain, aggregate, and inspect session
  decision trees from Cortex trace events. Subcommands: events,
  explain, stats, session, status. Connects directly to Cortex
  with fallback to plugin config for connection details.

- mayros plan: semantic plan mode with four phases (explore, assert,
  approve, execute). Plan state is persisted as RDF triples in Cortex.
  Subcommands: start, explore, assert, show, approve, execute, done,
  list, status. Assertions can be verified via Cortex Proof of Logic.
New extension that scans TypeScript/JS files using regex patterns
(consistent with skill-scanner.ts approach) and maps code entities
to RDF triples for storage in Cortex.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SHA-256 content hashing for change detection, plugin entry with
code_index_query tool, CLI subcommands (run, status, query),
and service registration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 unit tests covering scanner regex extraction, RDF mapper namespace
correctness, incremental hash computation, config parsing, and
plugin metadata validation. Also fix unused import lint warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ProjectMemory class with convention/decision/finding storage and
querying. New tools: project_convention_store, project_convention_query.
Enhanced agent_end hook with auto-detection of project knowledge.
Enhanced before_prompt_build with convention and finding injection.
Added projectMemory config section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CompactionExtractor extracts typed knowledge from both user and
assistant messages before context compaction: conventions, decisions,
file changes, bug findings, and error patterns. 21 unit tests.
Enhanced before_compaction hook to use structured extraction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Knowledge graph CLI with 8 subcommands: search, conventions,
decisions, code, explore, stats, status, explain. Provides unified
access to personal memories, project conventions, code entities,
and session findings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Version bump reflecting Phase 2 additions: project memory, smart
compaction, and cross-session recall capabilities.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Low-level git worktree operations for parallel agent isolation:
createWorktree, removeWorktree, listWorktrees, pruneWorktrees,
isWorktreePath, findWorktreeForPath. Uses execFileSync consistent
with existing infra modules. Includes 17 tests with mocked git.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TeamManager class for team lifecycle: create teams with shared
namespaces, track member states, orchestrate merge via KnowledgeFusion.
Follows PlanStore pattern with subject-per-team and delete-then-create
updates. Includes 16 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WorkflowOrchestrator class with phase-sequential, agent-parallel
execution model. Includes 3 built-in workflow definitions
(code-review, feature-dev, security-review) and a registry for
custom workflows. Cortex-backed state tracking with triple
persistence. Includes 25 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extend agent-mesh plugin with 3 new tools (mesh_create_team,
mesh_team_status, mesh_run_workflow) and team CLI subcommands
(create, status, list, merge). Add TeamsConfig and WorktreeConfig
types to config with parse functions and validation. Includes 12
new tests for config and registration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New subcli with 4 subcommands: run (execute a workflow),
list (available definitions), status (run progress), and
history (past runs). Reads Cortex config from agent-mesh
plugin entry. Registered in register.subclis.ts for lazy
loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Version bump reflecting Phase 3 additions: team manager, workflow
orchestrator, built-in workflow definitions, mesh tools, team CLI,
and workflow CLI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Team manager: test for late-join member update, test for mixed
member status merge (only completed members merged). Workflow
orchestrator: test for mixed run states in listing, test for
multi-phase aggregate computation, test for completion with no
executed phases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Command-level filtering for bash execution with domain allowlist,
command blocklist, and dangerous pattern detection. Includes command
parser with pipe/chain/subshell handling, 6 default dangerous patterns,
and configurable enforce/warn/off modes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Runtime permission dialogs with bash intent classification across 5 risk
levels, policy persistence in Cortex, and audit trail. Supports exact,
glob, and regex policy matching with auto-approve for safe operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Markdown-defined hooks in .mayros/hooks/ evaluated by LLM for policy
enforcement. Includes safe recursive descent condition parser, response
caching with session/global scopes, and dynamic hook registration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Connect to MCP servers via 4 transports (stdio, SSE, HTTP, WebSocket),
bridge MCP tools as Mayros tools, and register tool metadata in Cortex.
Includes session lifecycle management with auto-reconnect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add dependency audit with 8 security scan rules, update checker for
installed skills, category registry, hub_rate tool, and session_start
hook for update notifications. Enhanced search with trust badges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WebSocket client connecting to Mayros gateway with JSON-RPC protocol,
tree views for sessions/agents/skills, and webview panels for chat,
plan mode, trace viewer, and knowledge graph browser.
Include tools/* in pnpm workspace packages for the VSCode extension.
Update bash-sandbox, interactive-permissions, llm-hooks, mcp-client,
and vscode-extension versions to 0.5.0 for the ecosystem release.
- Add icon.svg and sidebar-icon.svg assets for VSCode extension
- Add webview CSS files (chat, plan, trace, kg) with VS Code theme vars
- Rename esbuild.config.mjs to .mts with proper type annotations
- Split tsconfig: exclude webview from Node check, add tsconfig.webview.json
- MCP client: switch from registerCommand to registerCli pattern
- MCP client: add after_tool_call hook for centralized usage tracking
DependencyAuditor now persists audit reports as RDF triples in Cortex
with per-finding granularity. UpdateChecker persists version check
history. Both accept optional CortexClientLike in constructor with
graceful fallback when Cortex is unavailable.

Triple namespaces:
  ${ns}:skill:audit:${slug} — report summary + findings
  ${ns}:skill:update:${slug} — version check history
New RulesEngine class stores rules as RDF triples with hierarchical
scope resolution (global → project → agent → skill → file).
Rules are queryable, learnable, and priority-sorted.

Includes CLI (mayros rules list/add/remove/learn/status), 21 tests,
and sub-CLI registration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New AgentMemory class stores per-agent memories as RDF triples with
type classification, project scoping, confidence tracking, and
usage counting. Memories persist across sessions and are recalled
by relevance.

Adds memory: boolean field to MarkdownAgent for opt-in persistent
memory per agent definition. Includes 15 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ApiliumDevTeam and others added 27 commits March 4, 2026 14:57
Register code-cli as a subcli and wire no-subcommand fallback in
run-main.ts so bare `mayros` launches the interactive TUI session.
Includes 4 tests for option parsing and defaults.
Bare `mayros` now checks wizard.lastRunAt: if missing, redirects to
`mayros onboard`; otherwise launches `mayros code`. Add onboard/code
to ALLOWED_INVALID_COMMANDS so they work without valid config.

Add 9 TUI slash commands (/plan, /kg, /trace, /team, /tasks, /workflow,
/rules, /mailbox, /onboard) that delegate to the agent via structured
messages, bridging Phase 2-5 features into the interactive session.

Includes 3 first-run gate tests and 13 ecosystem command tests.
Implement `mayros batch run` for processing multiple prompts in parallel
with configurable concurrency. Supports JSONL and text (--- separated)
input formats, JSON-lines output, per-prompt timeout, and result
streaming. Includes 18 tests covering input parsing and type validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement `mayros teleport export/import/inspect` for portable session
bundles. Exports session transcript (base64), store metadata, and Cortex
triples as a single JSON file. Import restores all components with
optional session key remapping. Includes 19 tests covering export,
import, validation, and round-trip integrity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New extension with pull-based delta sync protocol between Cortex
instances. Includes sync-protocol (conflict detection, LWW resolution,
reconciliation), peer-manager (Cortex-backed peer state, lifecycle),
plugin entry (3 tools: sync_status/sync_now/sync_pair, auto-sync hooks),
and sync CLI (status/pair/remove/now). 36 tests covering protocol
logic, conflict strategies, and peer management.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extends ProjectMemory with ingestMayrosMd() to parse markdown sections
into Cortex triples (conventions, key files, build commands, decisions).
Adds CortexClient.listTriplesSince() for timestamp-based delta queries.
Integrates sync pairing into onboarding wizard and registers /batch,
/teleport, /sync TUI slash commands with their handlers.
Introduces IntelliJ Platform plugin for Mayros with Gradle build config,
WebSocket JSON-RPC client mirroring the VSCode extension protocol,
application-level service for connection lifecycle, chat tool window
with message history and streaming, and persistent settings state.
Completes the IntelliJ plugin with agents tree view, trace events
table panel, quick settings panel, send-selection and explain-code
editor context actions, TODO/FIXME gutter line markers, and WebSocket
client unit tests.
Use execute() with details return instead of handler(), return content
as typed array, and replace registerHook() with api.on() for hooks.
batch-cli: clear timeout handle to prevent memory leak in batch ops
teleport: fix transcript filename on remap, use replaceAll for triple
  subject remapping, add Array.isArray guard in validateBundle, fix ~
  path expansion with os.homedir() fallback
sync-protocol: guard against NaN dates in resolveConflict and
  buildLocalDelta sort, change > to >= for inclusive delta boundary,
  simplify redundant reconcile condition
cortex-client: fix listTriplesSince off-by-one (> to >=) + NaN guard
project-memory: add fallback for empty slugify result, relax convention
  detection to sectionDepth >= 1
onboarding: add URL format validation for peer endpoint and alphanumeric
  check for peerId
jetbrains: fix Timer leak in reconnect, clear event listeners on
  reconnect to prevent duplicates, use consistent session keys in editor
  actions, add Logger for WebSocket parse errors, add clearEventListeners
- Replace global clearEventListeners() with per-panel unsubscribe
  pattern (ChatPanel and TracesPanel track their own listeners)
- Remove MayrosClient.clearEventListeners() (no longer needed)
- Add randomUUID suffix to slugify fallback for collision safety
- Add skipSync to onboarding test that was failing from sync step
- Document inclusive >= boundary design decision in sync-protocol
…solation

- project-memory: add continue after non-build cmdMatch to prevent
  bulletMatch fallthrough; normalize CRLF before splitting lines
- teleport: use Buffer byte length for transcriptSize instead of
  string length; guard NaN port with Number.isFinite fallback
- onboarding: use validated endpoint variable instead of dead code;
  trim peerId once into local variable
- onboarding tests: add skipSync to remaining tests; mock onboard-mcp
- JetBrains MayrosClient: @volatile on shared state fields;
  CopyOnWriteArrayList for event listeners; cancel reconnectTimer in
  disconnect(); snapshot pending requests before clear
- JetBrains MayrosService: CopyOnWriteArrayList for listeners;
  @volatile client; @synchronized connect()
- JetBrains panels: clear listener list on reconnect instead of
  calling off() on wrong (new) client instance
…nd JetBrains

Fix output ordering in batch CLI, atomic session store writes in teleport,
null-byte conflict keys and stable JSON comparison in sync protocol,
sort-before-limit in project memory queries, ScheduledExecutorService
for reconnect in JetBrains client, EDT-safe listener notifications,
and project-scoped gutter session keys.
…ple remapping

Clear timeout timer in syncWithPeer via try/finally, filter stats by
active status only, add Disposable to ChatPanel and TracesPanel with
listener cleanup, remap projectMemory triples and node references on
teleport import, graceful executor shutdown in MayrosClient, safe
asString in TracesPanel, sync-cli error handling, and peer ID validation
feedback in onboarding.
Sync 46 extension packages, VSCode extension, and JetBrains plugin
to version 0.1.4. Add missing SVG icon for JetBrains tool windows,
add @service annotation to MayrosSettings for proper IDE lifecycle.
The cortex-sync extension lacked a mayros.plugin.json file, causing
the manifest registry to emit error diagnostics during bundled plugin
discovery. This polluted config validation results and caused two
plugin-validation tests to fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VSCode and JetBrains plugins are being published for the first time,
so they start at 0.1.0 independently of the core Mayros version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ugin

Add Gradle 8.12 wrapper (gradlew) so the plugin can be built without
a system Gradle install. Set Java source/target compatibility to 17
to match the Kotlin jvmTarget and IntelliJ Platform requirements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…xtension

Port JetBrains-exclusive features: "Explain Code" and "Send Selection"
context menu actions with editor selection support, CodeLens gutter
markers for TODO/FIXME/HACK/mayros: comments, and upgrade the WebSocket
client to gateway protocol v3 with challenge-response handshake.
…tBrains plugin

Consolidate six separate tool windows into a single tabbed panel with
a setup screen for disconnected state and auto-detection of gateway
token from ~/.mayros/mayros.json. Add Skills, Plan, and Knowledge Graph
panels, agent filter on Traces, HTML chat bubbles with theme-aware
colors, and upgrade MayrosClient to gateway protocol v3 with
challenge-response handshake.
Rename `mayros dashboard` → `mayros team-dashboard` and `mayros doctor`
→ `mayros diagnose` for clarity. Update ci-plugin and lsp-bridge workspace
dependencies to use @apilium/mayros scope. Add gitignore entries for
JetBrains and VSCode extension build artifacts.
Gateway propagates isHeartbeat flag on chat events so TUI can suppress
heartbeat noise. History loader strips heartbeat prompt/response pairs.

Slash commands without arguments now open interactive select overlays
instead of printing usage text (/think, /verbose, /reasoning, /elevated,
/activation, /style, /theme). Deduplicate /agents→/agent, /sessions→
/session, /models→/model aliases and remove /elev, /reset, /quit.

Add elevatedLevel, groupActivation, and PendingImage to TUI state types.
New WelcomeScreen component with shield mascot avatar in golden gradient
and two-column bordered panel showing quick-start tips and session info.
Shown on first connection, subsequent session switches show plain text.
Responsive single-column fallback for terminals narrower than 70 cols.

Add Ctrl+V image paste support via clipboard capture — images are encoded
as base64 attachments and sent alongside chat messages. Editor inserts
an [Image #N] marker at cursor position.

Code CLI now shows onboarding hint on first run and supports --clean flag
to start with a blank chat while preserving session history. Gateway
disconnect handler distinguishes ECONNREFUSED with a helpful start hint,
and local pairing requests are auto-approved inline.
- hono 4.11.10 → 4.12.4 (cookie injection, SSE injection, serveStatic)
- @hono/node-server 1.19.9 → 1.19.10 (encoded slash bypass)
- dompurify ^3.3.1 → ^3.3.2 (XSS vulnerability)

Add hono as direct dependency to ensure pnpm override propagates to
transitive peer resolution through @buape/carbon.
Document all new capabilities in README: Terminal UI, IDE plugins,
Knowledge Graph, Multi-Agent Mesh, Plan Mode, Extensions Ecosystem,
Hooks System, and updated architecture diagram. Add .vscodeignore
for clean VSCode extension packaging. Gitignore internal docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ApiliumDevTeam ApiliumDevTeam merged commit 39e90d3 into dev Mar 5, 2026
1 check passed
@ApiliumDevTeam ApiliumDevTeam deleted the feat/cli-evolution-phase-1 branch March 5, 2026 22:14
ApiliumDevTeam added a commit that referenced this pull request Mar 9, 2026
)

## Summary

- **Terminal UI** — interactive TUI (`mayros code`) with 30+ slash
commands, 3 themes, vim mode, image paste, headless CLI (`-p`), markdown
agents/commands
- **IDE plugins** — VSCode extension (sidebar + 4 webview panels) and
JetBrains plugin (unified tabbed panel), both via Gateway WebSocket
- **Knowledge Graph** — code indexer (incremental TS/JS scanning → RDF),
project memory, smart compaction, cross-session recall
- **Multi-Agent Mesh** — team manager, workflow orchestrator (3
built-in), agent mailbox, background tracker, git worktree isolation
- **Plan Mode** — Cortex-backed semantic planning (explore → assert →
approve → execute)
- **Extensions** — bash-sandbox, interactive-permissions, llm-hooks,
mcp-client, code-indexer, cortex-sync, CI/CD, LSP bridge
- **Hooks** — 29 hook types, HTTP webhook dispatcher (HMAC-SHA256),
async queue with dead-letter
- **CLIs** — trace, plan, kg, workflow, dashboard, session, tasks,
mailbox, rules, batch, teleport
- **Security** — 18-layer architecture maintained across all new
features
- **README** — updated with all new capabilities, architecture diagram,
extensions table

## Test plan

- [ ] `pnpm build` compiles without errors
- [ ] `pnpm test` passes (~9200+ tests across 1035+ files)
- [ ] `mayros code` launches TUI with welcome screen
- [ ] `mayros -p "hello"` streams response in headless mode
- [ ] VSCode extension packages cleanly (`cd tools/vscode-extension &&
pnpm package`)
- [ ] JetBrains plugin builds (`cd tools/jetbrains-plugin && ./gradlew
build`)
- [ ] `mayros kg stats` returns Cortex graph statistics
- [ ] `mayros plan start "test"` creates a new plan
- [ ] `mayros trace status` reports Cortex connectivity
- [ ] `mayros workflow list` shows built-in workflow definitions
- [ ] README renders correctly on GitHub (tables, code blocks, diagram)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant