Skip to content

Core restructure - #710

Merged
ericdallo merged 24 commits into
masterfrom
core-restructure
Nov 17, 2026
Merged

ericdallo merged 24 commits into
masterfrom
core-restructure

Conversation

@ericdallo

@ericdallo ericdallo commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Continuation of #703, migrating more stuff from core -> modules, making eca easier to manage and evolve

ericdallo and others added 24 commits November 16, 2026 14:01
A new test reads the sources and checks the rules the core restructure
works towards: core namespaces fit 6 layers and require only their own
layer and lower ones; core requires no built-in module, checks no module
id with `modules/active?` and offers no multimethod for modules to extend.

What is left from before the rules sits in allowlists: 21 core -> module
requires (6 of them the startup of plugins, remote and otel, which stay),
13 module-id checks and 11 extended multimethods. The allowlists must match
exactly, so each later step removes its lines and nothing can come back.
A quoted `'eca.modules.x` counts as a require, so a `requiring-resolve`
can't hide one.

The rules are written down in docs/development.md ("Core and modules")
and AGENTS.md.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
Core no longer calls the hooks: the 13 hook types run as :eca/hooks'
handlers of 11 events (the subagent ones share their chat event), at
priority -1000, after every other module, so a module's block or stop
skips them as before. Keeping 0.171.1's hook behavior needed a few
additions to the (unreleased) module API:

- A :tool/called event, once the client got a tool call's result and
  before the model sees it. postToolCall hooks run there, so they still
  change only what the model sees, after the client shows the result.
- A built-in handler names who acted with :by ("hook 'lint'"), kept in
  ::events/by. Core's messages ("Turn stopped by hook 'lint': ..") come
  from one ended-message instead of a builder per actor.
- :additional-context may be a list, and a built-in's context may be
  unlabelled, so each hook's context is still its own plain block, kept
  where module contexts aren't: the request a compaction resumes,
  reopened chats, titles and exports.
- /compact's request reaches only the :chat/before-request handlers that
  ask for it (:compaction? true, built-in only): the preRequest hooks.
- :chat/after-compact carries the :summary postCompact hooks get.
- :eca/approval keeps a config deny with a second handler after the other
  modules, instead of core. It runs the rules again only when a module
  changed the arguments or decided with its own reason, so they still run
  twice per call.

One small difference: a preToolCall exit 2 with only whitespace on stderr
now counts as no stderr ("Tool call rejected by hook").

New characterization tests drive the hooks through prompts, tool calls,
/compact, deleting a chat and shutting down; they passed before this
change and still do. The guardrail's allowlists lose the four hooks
requires and the :eca/approval id check.

Two bugs 0.171.1 has too are kept as they are: legacy prePrompt hooks
never run, and a visible preRequest block followed by a successful hook
loses the blocking hook's name.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
A first, mechanical half of splitting the chat engine: whole functions
move, unchanged, out of chat.clj and tool_calls.clj into namespaces that
each do one thing, and the chat engine's aliases become f.chat.<feature>.

- replay: a chat's history as the client shows it.
- system-prompt: the cache signature and the notices about it changing.
- steer: what a typed message is, and messages steered into a turn.
- ops: list, open, clear, rename, roll back, flag, fork and delete a chat.
- tool-batch: a batch of tool calls, from each call's decision to how the
  turn goes on; tool-calls keeps the tool call state machine.

chat.clj goes from 3145 to 2260 lines and tool_calls.clj from 1141 to 553;
the turn itself (prompt-messages!) is split next. A private function
became public only where another namespace calls it; tests still reach
private ones with #'. The guardrail's mcp require moved from tool-calls
to tool-batch with the code that has it.

No behavior change: unit tests, golden dumps and JVM integration tests
are unchanged.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
The second half of splitting the chat engine: prompt-messages!, ~950
lines with every stream callback inline, becomes a composition.

- turn: prompt-messages! (the pre-request, the request's start, the
  title, then a worker that sends the request), over a turn map: the
  chat-ctx, the request's state and add-to-history!.
- callbacks: the request's stream callbacks as top-level functions,
  and the next round after tools ran.
- recovery: a failed request (modules first, an overflow, a rejected
  image, the provider's recovery, auto-continue), a cut response.
- compaction: the compaction triggers, with lifecycle's compaction
  runtime and checkpoints.
- system-prompt: prompt*'s choice of the chat's system prompt.

Compaction and recovery send the turn's next request through
:continue-turn-fn in chat-ctx, prompt-messages! itself, so the
namespaces stay acyclic. Copies go: "finish this request, then send the
next one" (5) is recovery/continue-turn!, "send it again without
compacting" (3) compaction/retry-without-compaction, "are the user
messages in the history?" (4) one predicate, and web search and image
generation share the provider-run tool states.

continue-turn! sets :continuing? instead of :auto-compacting?, which now
only means a compaction. finish-chat-prompt! and the readers that mean
busy (auto-compact?, request-compaction!, a failed request) read both,
and the sites that reset the flags clear both, so the chat behaves the
same. The compact_chat tool keeps reading the compaction flags only: no
tool runs while a request hands over to the next.

Tests follow the moved private vars; two pass :continue-turn-fn instead
of redefining prompt-messages!, and new assertions pin :continuing?. No
behavior change: unit tests, golden dumps and JVM integration tests are
unchanged. chat.clj, the entry, is still ~730 lines until commands and
the prompt's data leave it (steps 4 and 6).

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
Core no longer decides when to title a chat, nor how. At every request
of a chat the user didn't name, it asks the :chat/title handlers in the
background and titles the chat with the first answer, unless the user
names it meanwhile.

The new built-in module eca/chat-title answers as core did: at the
chat's first request without a title and again at its third, the chat
model writes the title with tools and reasoning off. It owns chat.title
and prompts.chatTitle, whose defaults move from core's config into its
config spec; the title transcript and prompt move with it.

For modules, :chat/title is now asked at every request (nil keeps the
title), with :messages, :prompt-messages (the new request's messages
without attached contexts), :prompt-count and :title instead of
:retitle?. With eca/chat-title disabled and no other module, chats get
no title.

Titles are the same: unit tests (two new ones pin the event), golden
dumps and JVM integration tests are unchanged.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
Core no longer knows the summary: it runs the compactions modules ask
for, with the compaction events, checkpoints and guards, and /compact
asks the modules. eca/compact-as-summary now says when and how.

- When: past its threshold it asks for a compaction from
  :chat/usage-updated, and from :chat/before-request for a chat already
  past it at the user's request (a chat resumed after a restart, a
  lowered threshold), dropping its request otherwise; it answers a
  context overflow from :llm/request-failed. Core takes requests where
  it checked the threshold: before a request and after tool calls.
- How: it answers :chat/compact with a request of the chat, the
  summary prompt, that core sends as the turn's next request (or as
  /compact's prompt), asking it when the request is done and having it
  write the summary as the checkpoint. The compact prompt, the summary
  checkpoint and the thresholds move into the module.

autoCompactMaxPerTurn becomes core's, the cap of compactions in a
turn; the #391 guard stays in core and is released by the threshold
the module gives in its :chat/usage-updated answer, which clients get
in the usage and /context shows. Core shows "Context window exceeded"
for any overflow compaction. The id check of the summary module goes.

One fix: a compaction blocked by a preCompact hook after tool calls sent
the user's message to the model again, as a new request; now the turn
goes on with the tool results, as after a module's blocked request.

For modules (unreleased API, documented): a {:compact ..} answer obeys
the guards and no longer stops asking modules for the rest of the turn,
so an external :retry keeps the summary from compacting an overflow in
the retried request; :chat/usage-updated takes :auto-compact-percentage
and also comes when /context refreshes the usage; cancel-compaction!
drops a module's request. The :chat/title event definition gets 3a's
keys.

Unit tests (new: compaction at a user request, a blocked compaction in
the tool loop), golden dumps and JVM integration tests pass.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
run-built-in! was one case of 20 commands, reached by name through
requiring-resolve. Each command now has its handler, declared with it:

- eca/chat-management, a new built-in module: /fork, /btw, /resume,
  /chats, /delete-chat, /export, /import and /debug-chat, with the fork
  helpers.
- eca/core: the other twelve (/compact, /login, /model, /costs, /quota,
  /context, /remote, /config, /doctor, /prompt-show, /sync-system-prompt,
  /modules), with their text helpers, referenced directly.

built_in_command.clj and run-built-in! go. fork-title and
drop-dangling-tool-calls, which chat ops and inline prompts also use,
move to eca.features.chat.ops. commands.clj keeps the dispatch, the
command order and the argument helpers.

The command list clients see is the same (golden dump), as is each
command's behavior: unit tests, golden dumps and JVM integration tests
pass.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
Core no longer reads skills, custom commands or MCP prompts to list and
run them: their modules give them as commands. A built-in module's
:commands may be a function of ctx (:config, :db) giving [name command]
pairs in order, and a command it gives with a :client-type (:mcpPrompt,
:skill, :custom-prompt) is listed under that type:

- eca/skills gives /skills and each skill, with the "Load skill" nudge
  and the arguments of a skill typed as a command.
- eca/custom-commands gives each custom command, with get-custom-command.
- eca/mcp gives each server prompt as server:prompt. Its handler returns
  the messages to send (:send-messages), or the text to show when the
  server fails or gives none (:system-text, finished as before, with the
  post-request hooks).

The list clients see is the same, in the same order: MCP prompts, the
modules' own commands, skills, then custom commands. So is what runs: a
module's own command, else a custom command, else a skill; an MCP prompt
runs only as one. commands.clj makes substitute-args and
add-file-context public for those modules. chat.clj handles a command's
and an MCP prompt's results in one place; an MCP prompt's errors still
end the prompt as a normal prompt's do. /modules lists a built-in's own
commands only.

Core requires 4 fewer modules (commands -> custom-commands, mcp, skills;
chat -> mcp) and checks 5 fewer module ids. AGENTS.md and
development.md describe commands.clj and eca.modules.core as they are
now.

Unit tests (new: command sources, /modules listing them), golden dumps
and JVM integration tests pass.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
server.clj's 46 defmethods become core-methods, a table of method ->
kind, handler, thread and config, served by jsonrpc4clj's :default
methods: core's table first, then the modules' :rpc, else the library's
own ::method-not-found, so unknown methods get the same "Method not
found" error and warning as before. Each method runs where its
defmethod ran it (its own thread or the protocol thread, with the config
or, for chat/prompt, resolving its own).

:rpc is open to external modules: {"ns/method" {:kind :request or
:notification :handler (fn [ctx params])}}, validated and documented in
modules.md. Core's methods win; between modules, the first to start. A
built-in module's methods are served whatever its state, as before
modules (mcp/* run with eca/mcp off too); an external module's only
while it's active.

Inline completion and rewrite move into two built-in modules,
eca/completion (completion/inline) and eca/rewrite (rewrite/prompt),
with their handlers and prompt builders; their config defaults stay in
core until step 8, so their methods answer as before also while the
modules are disabled. prompt.clj keeps a public prompt-file for their
legacy systemPromptFile.

The messenger gets a generic notify! (method, params), replacing
rewrite-content-received and jobs-updated; the remote broadcast still
sends jobs/updated to SSE clients, as jobs:updated, and keeps rewrite
content to the editor.

Unit tests (new: every client method of protocol.md is served with its
kind; dispatch to core, built-in and external modules), golden dumps
and JVM integration tests pass.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
The jobs registry (features/background_tasks.clj) becomes the shell
module's eca.modules.tools.shell.jobs, and jobs/list, jobs/kill and
jobs/readOutput its :rpc, with the same metrics tasks. The module now
runs (a no-op :start) so that its :stop kills the running jobs: at
shutdown, where core called cleanup-all!, and now also when eca/shell
is disabled or reloaded.

Finished jobs reached the model through core: at the tool loop's next
round, after the steered message, callbacks drained the chat's
:pending-job-notifications into the history. Core now emits a new
event there, :chat/next-round, whose :notes go into the history as
user messages; eca/shell answers it with the same texts, at the same
moment, and marks the jobs notified as before. Core no longer knows
about background jobs. The event is documented in modules.md.

Unit tests (new: the jobs' notes, the event, a finished job reaching
the model after a steered message), golden dumps, and JVM and native
integration tests pass.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
The repoMap context has been deprecated since 0.59.0: eca__directory_tree
gives the model a better, more specific view. This removes it with its
module, eca/repo-map: the context type (in the @ list, the refined
contexts and the attached contexts sent in the user message), the
/repo-map-show command and the index.repoMap config. The prompt
builders, contexts-str and the attached-contexts helpers lose their repo
map argument, and chat no longer requires the module.

The module also owned the index config key, whose ignoreFiles default
(.gitignore) the @ file search and the filesystem tools read: that
default now lives in core's config, so they keep honoring .gitignore,
also when no module provides it (disabling eca/repo-map used to drop
it).

Docs: protocol.md drops RepoMapContext, features.md and the modules
table drop the command and the module, config.json and the config
example drop index.repoMap; a CHANGELOG line.

Unit tests, golden dumps (intended diffs only: no /repo-map-show, no
index.repoMap) and JVM integration tests pass.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
prompt* gathered the rules (m.rules/all-rules) and the skills
(m.skills/all, minus the ones the skill tool's approval denies) and
passed them positionally, with the other inputs, through the cache
signature and the prompt builders for the sections to read back. Now
the builders take one prompt ctx (:refined-contexts :agent :config
:chat-id :all-tools :db :full-model) and the rules and skills sections
compute their data from it, the approval filter moving into eca/skills.

The cache signature follows those sections through a new built-in-only
section key, :signature, hashed under the section's name, :rules and
:skills, with the same inputs as before; :resync? false on skills keeps
"skills changes never re-sync a pinned prompt". The signature map keeps
its keys, order and hash values, so a chat's persisted prompt cache and
the notices ("System prompt changed (rules, skills)") are the same.
Signatures are computed whether the section's module is active or not,
as core followed that data before modules; only the content needs it
active.

Chat no longer requires eca/rules and eca/skills. The content is
computed again when the prompt is rebuilt (not when it's pinned).

Unit tests (new: section signatures), golden dumps (identical) and JVM
integration tests pass.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
A new built-in-only module key, :contexts, has two parts:

- :always, contexts every chat gets first: core's always-contexts
  replaces context.clj's AGENTS.md code, which moves into a new
  built-in module, eca/agents-md (each workspace's AGENTS.md, its
  parents' with includeParentAgentsFiles, which it now owns, the global
  one, and the files they mention with @path). Core still renders them
  in the :eca/context section, so the prompt and /context's AGENTS.md
  row are the same; turning the module off drops them.
- :types, context types a module gives: :list adds @ completion items
  after core's, :refine turns a client's context of that type into what
  the prompt gets. eca/mcp gives mcpResource this way (all-resources,
  get-resource!), in the same place in the @ list.

context.clj no longer requires eca/mcp. safe-canonicalize becomes
public for eca/agents-md; the AGENTS.md tests move with the code.

Unit tests (new: the module's contexts through core), golden dumps
(identical) and JVM integration tests pass.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
Core no longer checks whether eca/tool-search is active to defer tools.
all-tools now ends by passing the final tools through each active
built-in module's :transform-tools, (fn [ctx tools]), in module order,
with the config, db, chat, agent and model. Tool search's transform marks
the deferred MCP tools (mark-deferred-tools and its helpers, moved
verbatim from tools.clj) and drops search_tools when nothing is deferred,
as core did. get-tool-patterns and tool-matches-any? are public for it;
core keeps tools-for-llm.

:transform-tools is built-in only and must be a function. The
architecture test loses the tool-search id check.

Same tools and prompts: golden identical, tool search tests unchanged.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
Core no longer lists or calls MCP tools itself. A module's :tool-servers
{:list :call :await-refresh}, open to external modules, gives servers
with their tools. Core lists those tools as it listed MCP's (:server,
origin mcp, a module tool can replace one; a server name another module
already has is ignored, with a warning), sends their calls to the
module's :call (an external module may answer a string), and after each
batch of tool calls waits for each module's :await-refresh within one
5 s deadline, as it waited for MCP's.

The MCP module serves its tools this way: :list gives the servers in
:mcp-clients with their tools, then the disabled ones that don't run,
for the tool server refresh to come. m.mcp/all-tools goes; the tests
that stubbed it put the MCP servers in the db instead. tool-batch no
longer requires the MCP module, and tools.clj has one :eca/mcp check
less.

Same tools and prompts (golden identical); unit, lint and JVM
integration green.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
Core no longer requires the MCP module nor checks whether it's active.
MCP servers still start last in the session's startup, after the
sessionStart hooks, the chat config and ECA's own tool server (clients
and mcp_remote_test see the native server first): core now emits a new
notify event there, :session/ready, and the MCP module starts its
servers in its handler. Config changes reach modules through another new
notify event, :config/changed (:prev-config, :config), emitted where the
MCP reconcile ran, in the same order; MCP reconciles its servers there
when it was active already.

The module also gets :start and :stop. :start starts the servers when
the module is enabled after the session is ready (modules/session-ready?,
set before :session/ready); :stop shuts them down when ECA exits, as
handlers/shutdown did, or stops each one and tells clients they're gone
when the module is disabled. So /modules disable eca/mcp now stops its
servers too, and disabling it in the config no longer deletes their
OAuth tokens (the reconcile's removal path did). 0.171.1 couldn't
disable MCP.

The nine mcp/* methods are MCP's :rpc now (a built-in's, so served
whatever its state, as before), with the server wrappers and the
tool/serverUpdated notifications moved from handlers.clj and tools.clj;
the remote module's REST routes call them there. A tool server refresh
(agent switch, tool config change) sends the built-in modules' servers
again from their :list (MCP's say type mcp: same payloads as before),
and the external modules' tool servers go to clients as type module
servers, as the plan decided.

The architecture test's allowlist is down to the six startup edges, and
no :eca/mcp check is left. The tests of the moved methods move to
mcp_module_test, which now covers the lifecycle; docs: modules.md (the
events, tool servers to clients), protocol.md (module servers).

Golden identical; unit, lint and JVM integration green.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
Core's render-context no longer knows the mcpResource type: the MCP
module's resources section renders each resource itself, with the same
<resource uri="..."> text, and contexts-str takes contexts given as
their text already. A new assertion pins the section's text.

development.md's context.clj row still mentioned the repo map, removed
earlier on this branch.

Golden identical; unit, lint and JVM integration green.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
The three tools.util multimethods (a call's details before and after it
runs, and the cleanup of what it left) become tool definition keys:
:details-before-fn (fn [ctx args]), :details-after-fn (fn [ctx args
before-details result]) and :cleanup-fn (fn [resource-kind resource]),
for built-in modules' tools only for now (external ones lose them). The
filesystem, shell, git, task and subagent tools declare theirs; the MCP
module gives the clojure-mcp ones to the tools with those names, on any
server, through its tool server list.

The matching stays as it was: the details went by the bare tool name, so
a tool of another server without its own (an MCP server's write_file,
say) takes those of ECA's tool with its name; cleanup goes by full name.
Without one, the defaults are as before.

Shell and git call their own cleanup directly. A tool server refresh
sends each tool's name, description, parameters and status: the same
payload as before for MCP's.

The architecture test allows three fewer extended multimethods. Golden:
the tool dumps list the new keys (new baseline post-8a), prompts
unchanged. Unit, lint and JVM integration green.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
The eight core multimethods the provider modules extended become entries
of their `:providers` declarations, found by the provider's base, as the
methods dispatched, so inheriting providers keep their parent's:

- login-step: :login {:steps {:login/start f ...}}; the provider picker
  without a provider stays in login.clj
- start-login!: :start on each :login :methods entry (stripped from what
  clients get)
- complete-oauth-code!: :login :complete-oauth-code
- fetch-quota: :quota {:fetch f}
- provider-models-override: :models-override-fn (OpenAI's checks the
  OAuth login itself, as the method's dispatch did)
- enrich-provider-error, recoverable-error?, recover-error!: :errors
  {:enrich :recoverable? :recover!}; Anthropic's enrichment leaves core's
  errors.clj for its module

Core keeps functions with the same names and arguments that look the
declarations up (llm-util/provider-declaration) and fall back as the
default methods did; their callers pass the config. External modules
can't declare these functions yet, and login-config doesn't save the new
keys into the config.

New with modules: a disabled provider module takes its login, quota and
error handling with it; the multimethods ignored its state.

No core multimethod is extended by a module anymore. Golden identical;
unit, lint and JVM integration green.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
The config engine no longer knows agents beyond reading them. What
all-layers* did for them moves to the agents module, which handles
:config/resolve first (priority 1000), so other modules' handlers see
the agents as before: the legacy keys (behavior as agent, agent and
build as code, defaultBehavior), then the modules' agents (the Markdown
ones) and the plugins' under the config's own, then inherit. The
functions move as they were, with a copy of config's deep-merge, and
the inheritance warnings keep their [CONFIG] tag. The :config/resolve
event's ctx gets the db, as the Markdown agents read the workspaces.

New with modules: disabling eca/agents also drops the plugins' agents,
the legacy keys' migration and inherit, not only the Markdown agents;
eca.api.debug/config-raw, the config before :config/resolve, shows the
agents before them.

The inheritance test moves to agents_test, with a new one for the
legacy migration. Golden identical (the config dumps too); unit, lint
and JVM integration green.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
db.clj held the state's shape and its whole persistence in 1,089
lines. Its forms move, as they were, into five namespaces under eca.db:

- eca.db.io: the cache files, their versions, transit reads and writes,
  atomic moves and file locks
- eca.db.chats: chat files and their index; saving, loading, deleting
  and cleaning them up
- eca.db.global-cache: the global cache of logins and its lock
- eca.db.migration: loading the caches at startup, the index checked
  against the chat files, the old whole-workspace caches migrated
- eca.db.workspaces: other workspaces' chats, for listing

eca.db keeps the shape (_db-spec), the initial db, db* and the chat
tree and approval helpers, and requires none of them. Callers and tests
use the new aliases (db.io, db.chats...); the helpers the namespaces
share became public. Cache formats and paths are unchanged. The
architecture test counts eca.db.* in the state layer. AGENTS.md and
development.md describe the split.

Golden identical; unit (no reflection warnings), lint and JVM
integration green.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
development.md lists quota.clj and the modules added on this branch
(agents-md, chat-title, compact-as-summary), and its rules name what
modules contribute now (tool servers, protocol methods, contexts,
providers) and the one id check left, at the startup of remote and
otel. The CHANGELOG's module entry says what a module can add.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
A review of the whole branch found no break of a common 0.171.1 path. These
are the edge cases it found, with a test each when behavior changes:

- A compaction the summary module asks for, blocked by a preCompact hook in
  the tool loop, stays blocked for the rest of the turn, as before modules:
  a retry or an auto-continue no longer runs the hook again. The "Last
  auto-compaction allowed in this turn" warning is logged again.
- postToolCall hooks get the tool's name also when the tool is gone once the
  call ends (its MCP server restarted), so their matchers still match.
- An external module's event handler can't run after eca/approval keeps a
  deny from the config (-900) nor after the shell hooks (-1000): a lower
  priority runs right before them, in its order among the external ones.
- Stopping an MCP server while it starts (also by disabling or restarting
  eca/mcp) shows it stopped instead of failed later, doesn't leave a failed
  server that re-enabling would skip, and no longer drops the registration
  of the init that took its place.
- An external module's tool servers are checked: one without a name, or a
  tool without one, is left out with a warning instead of breaking every
  tool list; ECA's startup tool server refresh can't keep MCP from starting.
- A blank title from a module keeps the chat's title; an external section's
  :signature and :resync? are refused like the other built-in-only keys.
- Warnings repeated on every call (duplicate tools, tool servers, commands
  and methods) are logged once.
- The architecture test sees module ids in any call into the module
  runtime, quoted requires, fully qualified calls and requiring-resolve up
  the layers, and fails when it finds no source.
- Docs, docstrings, requires and comments that no longer matched the code;
  functions used only in their namespace are private again.

🤖 Generated with [ECA](https://eca.dev) (nubank-anthropic/opus-5.5 - max)

Co-Authored-By: eca-agent <git@eca.dev>
@ericdallo
ericdallo merged commit 2a9d165 into master Nov 17, 2026
9 checks passed
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