Skip to content

Agent System ​

The Agent system (named NekoPower in the interface) is how the character gets things done outside the conversation. The main dialogue model decides whether something is to be done and says so with a tool call. The NekoPower host inside the Agent Server keeps the record, decides who does the work, runs it, and reports back. Nothing analyses a finished turn on its own initiative: the former per-turn analyzer and its execution channels have been removed.

Two terms are used throughout: a commission is one thing the character handed over, and a task agent is an execution session that works on a commission in several steps. The interface shows a task agent to the user as a "familiar"; code, routes, and field values use task_agent.

Runtime components ​

text
Main Server                                   Agent Server (:48915)
┌───────────────────────────┐                 ┌──────────────────────────────────┐
│ LLMSessionManager         │  HTTP           │ NekoPower host (nekopower/host/)  │
│  tools: dispatch_task     │ ──────────────> │  ├─ task brain                   │
│         query_tasks       │ <── receipt ─── │  │   ledger · decision model     │
│ cross_server.py           │                 │  ├─ task agent manager           │
│ MainServerAgentBridge     │  ZeroMQ         │  ├─ capability gateway           │
│ pending_agent_callbacks   │ ─ turn check ─> │  └─ permissions                  │
│                           │ <── reports ─── │ embedded plugin service (:48916) │
└───────────────────────────┘                 └──────────────────────────────────┘

There is one host per Agent process. Startup only registers how the host reads the process's switches (app/agent_server/nekopower_mount.py). The ledger file, the agent runtime, and the gateway listener are created the first time they are needed.

The two task tools ​

While the master switch is on, main_logic/core/tool_calling.py registers two built-in tools for the main dialogue model (even when the keyboard-and-mouse, browser, and plugin switches are all off; a task agent that needs an off capability can ask the user to enable it through enable_capability on the gateway). Each takes one natural-language sentence and no identifier; which commission a sentence is about is worked out by the host. The definitions are in config/prompts/prompts_task_tools.py.

ToolArgumentUse
dispatch_tasktaskHand over something to do. Additions, changes of mind, stop requests, and the user's answer to a pending question also go through it
query_tasksquestionAsk what is under way, how a commission is going, or whether something can be done. An empty question lists what is under way

The handlers call POST /nekopower/dispatch and POST /nekopower/query on the Agent Server and wait at most 2.5 seconds for the whole request. If the Agent Server cannot be reached, or turns the request down without acting on it (a 4xx status), the tool result states that the task was not handed over. If the request went out and no answer came back in time, or the Agent Server answered with an error of its own (a 5xx status), it states that it is not known whether the task was handed over (the Agent Server may be carrying it out all the same) and tells the model to check with a query instead of dispatching again. Proactive chat requests carry neither tool.

Inside the host ​

Task brain ​

  • Ledger. One SQLite file, <data root>/nekopower/ledger.db, holds the commissions, their events, the sessions task agents work in, an outbox of reports, and task preferences. A commission is queued, working, waiting_user, done, blocked, failed, or cancelled. The status changes in a single function; done and cancelled are final, so a late result cannot overwrite a stop.
  • Dispatch, first round (waited for). While there is work the sentence may be about (her commissions under way, what waits for the user within them, what ended in the last day), one small-model request reads what the sentence does with it (LexicalDecisionModel.read_under_way): it answers a waiting question (for a request for approval, what was chosen, always, this session, this once, deny or not said, is read by one more request (_read_choice) that is shown what kind of thing is asked in the host's own words, the answers on offer, her sentence and the user's own words beside it, never the command or path a task agent wrote; a bare yes with several questions waiting answers none, and with several requests for approval waiting the user is always asked which, and told the buttons on each question say which; typed or said, an answer allows that one request at most: always and this session come from the buttons alone, and the receipt says so), stops the commissions it names (and says whether it means just those, all the work of a project, a familiar or a plugin, or all of it; when the list left some of her work out, the user is asked first for all of it, for a stop of several unless it is all of one project's and what was left out is other work, and whenever more of the stopped one's project, familiar or plugin was left out; one that does not say which, or names none, while several are under way, stops nothing and the user is asked which, and one thing under way is stopped; a bare "wait" while one question waits is read as refusing what it asks, not as a stop; with several waiting, the user is asked which; what it could not stop, or stopped without everything it was running confirmed ended, the receipt names), says more of one commission (passed on to it; for one that ended, gone on with in its session), or is new. The model is shown each commission's status, its project, the familiar on it by the name the user calls it, what the members of a team are at, and what it asks. What task agents wrote there (titles, commands, paths, questions, what work ended with) is quoted, and the prompt says it is what the sentence is sorted by, never instructions. The sentence's words are passed on as they are. A first reading that does not come in time or cannot be read is taken for new, and the receipt says it could not be told; when the choice of an answer to a request for approval is what cannot be read, the question stays and the user is asked to answer it again. Then local matching decides whether the sentence repeats something under way, whether keywords or BM25 find candidate plugins, and whether a task agent can be started. A sentence that adds to a commission a task agent finished, or was stopped on, within the last day becomes a commission of its own. The second round chooses for it as for any other: a plugin that is picked does it, and only when it is handed to a task agent does it go on in that one's session; one that adds to a commission that failed takes that commission up again. The receipt says "already under way", "nothing can do this" (with the reason), or "accepted". No other model is called, except for one small-model screen when nothing matches locally and no task agent can be started. After one second the receipt is "received" and the conclusion follows as a report.
  • Dispatch, second round (in the background). The decision model (nekopower/host/decision.py) selects a plugin entry and fills in its arguments with one model call. When all plugin descriptions together exceed 3000 tokens, a coarse stage first keeps the union of keyword hits, the ten best BM25 matches, and a small-model screen. Plugins come first: a task that one entry can finish is called directly through the plugin service's /runs protocol. If no entry fits, or the task needs several steps, the commission goes to a task agent. The model can also answer that neither can do it, or that it is not a task at all; nothing is started then. An answer naming a plugin or entry that does not exist is not asked about again: it is treated as no entry fitting. If this round overturns the receipt, the character is told at once.
  • Query. Never calls a model. Progress is read from the ledger, and "can this be done" reuses the first round's local matching without filing anything. The line of a commission a task agent worked on says how many tokens it has used so far, when any usage is on record for it (none is when the model's provider reports no usage).

Task agents ​

A task agent works in a session of the built-in agent runtime (nekopower/runtime/), which runs in a subprocess started on demand. A session is a conversation that is kept and can be gone on with, and the ledger has a row for each. A commission that belongs with a project goes to the project's leader when it has one, else to the member of the project that works; a commission that follows up an earlier one, in that one's session; one that belongs with a task agent that is there, in that one's session; any other, and every task agent started by a task agent, in a session of its own (see Families and leaders below). A session takes one commission at a time: the next one stays queued until the one before it is done, failed, stopped or blocked, and also while that one waits for the user. Meanwhile a later commission of a project that she dispatched and that is a side question (it only asks, and changes nothing: one more small model request tells, made only when a copy would be made; anything else, or what cannot be told, waits for the session) is worked on in a copy of the project's session (see the fork below), when a place is free, at most three at a time for one session, and when the session made a model request in the last five minutes, so that its conversation is most likely still in the provider's cache (otherwise every request of the copy would send all of it at full price; however short the conversation, the commission then waits for the session itself): it reads, searches and answers there, and is told the question the session itself waits for the user to answer, if any, which is not its to settle. When it calls a tool that writes a file, runs a command, calls a capability or starts a task agent, the call is not carried out; it is told to write down what it found (one more model request), and is then handed back to the session itself, where it waits as it would have and goes on with what the copy wrote down and what the user said to it meanwhile. A copy is not gone on in once its commission ended: what the user says to it next goes to the session itself (to a new copy, should the session be busy and it be a side question again), and one that got stuck there is taken up again in the session itself. Every copy reports to the session itself, for its information only: the user's words, what came of it (answered, stuck, failed, or handed back), and which copy (five at the most, 600 tokens, written by the host without a model). The session is told before its next step while it is at work, once it goes on while it waits for the user, and with the next commission opened in it while it has nothing to do; it is never woken for this. At most ten sessions are at work at the same time; further commissions stay queued. The runtime's session is opened when a commission starts and closed when it ends; what was said stays on disk, and the next commission of the session goes on from it.

What a commission is (the dispatched sentence, the user's own words, how the user wants such things done, the plugin entries picked for it, the files the repository it works in keeps for agents) is the message that opens it in its session; it is not part of the system prompt. A commission that starts in a session in which nothing was said yet is also handed an excerpt of the main dialogue in that message: the last things the character and the user said before the dispatch, word for word, 1,000 tokens at the most, marked as background and not as instructions. Each message is one line there: line breaks and runs of blanks inside a message are folded into single spaces. Beyond that the task agent does not receive the conversation history of the main dialogue. The system prompt and the tool definitions a session was first opened with are kept in its directory (system.json) and used again whenever it is opened, so the head of its requests stays the same from one commission to the next. What differs from one session to the next in the system prompt (the working directory, the reply language) comes last. What is in front of it is the same for two sessions that are offered the same tools and given the same instructions by the host (the same character, the same project and its rules), so their requests share a longer head; whether a provider reads that head from its cache is up to the provider. They are put together anew only after the conversation was summed up (and once with the next start of a session whose preset was changed; see “Changing a preset” below): until then a tool that is gone answers that it cannot be used right now, and a built-in tool that came since is not offered. A session's conversation is managed for a preset context window of 200,000 tokens and summed up from 170,000 on; the user may set both for a model (the built-in free model is managed for 128,000, because it cuts a longer request off without saying so). Once the model's provider refuses a request as too long, the session and those after it are managed for a smaller window by themselves (the window the provider states, or the length of the refused request when it states none), and the user is told once to set the model's context length.

A task agent runs on the model its session was settled on when the session was made, by its preset (nekopower/host/role_models.py): each preset has a setting of its own, a slot of the model panel that declares tool calling (one that follows the agent model, one that follows the small agent model, or one the user filled in) or inherit (the model of the session that started it); left unset it takes its default, which is the agent model (the slot that follows it) for boss and general, the advanced agent model (the slot that follows it and declares tool calling, else that tier itself, else the agent model) for planner, and inherit for the others, so out of the box every task agent but a planner runs on the agent model as before, and a planner does too until the user sets the advanced agent model apart from it. A copy runs on the model of the session it was copied from. A slot that cannot be used (removed, unreadable, its tier not configured or not an HTTP endpoint, no tool calling) leaves the preset with its default, and the card says why (model_fallback). A model set for a preset is used in the built-in runtime only; a session begun in dsh goes on there with the agent model. Only requests that go with the built-in free key count against the free daily quota. The host reads and writes the settings with role_models() and set_role_model(), exposed to the console at GET and POST /console/role-models. A task agent can start task agents of its own. When it asks the user a question or needs a permission, the commission is waiting_user until the character passes the answer on with dispatch_task.

What every model request used (requests, input, output, cache reads, cache writes) is kept in the ledger, with the session and with the commission; what a task agent started by another uses counts for the commission that started it as well. One commission may use five million tokens by default (what every request sent and got back, cache reads included). The limit is looked at once a step, before the step's model request, against what the ledger has by then: when that much is used, the built-in runtime stops there (a tool that is running is not cut off; within a step, a summary of the conversation or a retry after a request was refused as too long is not looked at again, so a little more than the limit can be used), the commission becomes waiting_user, and the user is asked once, as for a permission; the question says how much was used and how much more is asked for. Allowed, it gets five million more and asks again when those are used; refused, the task agent is told to hand over what it has and to say what is missing, within four more steps (a model request each; a summary of the conversation on the way, or a retry after a request was refused as too long, is not counted): the commission is recorded as blocked, or as done when the task agent reports that it is in fact complete. dsh makes its requests by itself and has no such place to stop at: usage is counted there, the limit is not applied.

A session can be forked: what was said in it is copied into a new session (up to the last place where it is whole, every tool call with its result), which keeps the system prompt and the tool definitions of the one it was copied from, so its requests begin exactly as that one's do. The session that is copied may be at work and is not disturbed. The copy shares the working directory of the other, so it is not given the tools that write files, run commands or call capabilities, and the gateway refuses its calls as well: it reads and answers. What was said in a session is not removed while a copy of it is being made, or while a commission is at work in one of its copies. Only a session of the built-in runtime can be forked. One session asking another a question is answered in such a copy (see below).

The host can also sum up the conversation of a session that has been idle for a while, so that the next commission carries less of the old conversation. That holds for the session of a project and for one of a single commission alike; not for the sessions of task agents another one started, nor for copies. It is one more model request, made by the host itself. It is on by default (TASK_AGENT_IDLE_COMPACT_ENABLED) and begins 24 minutes after the last commission in the session ended, a time the user can set for the model. Nothing is summed up while NekoPower is switched off, once the daily quota is used up, after the user stopped everything (until something new is to be worked on in the session), or for a session that has ended (below), and a commission that arrives for the session cuts a summary under way short. The commission then waits for the runtime to close the session the host had open, for 30 seconds at the most; when the runtime does not say that it has, the commission fails with that as its reason and can be handed in again. When no whole summary comes back (the request fails, ends at its length limit, or the model calls a tool instead of writing one), the conversation stays as it was and the host does not try again by itself: the next time is when another commission in the session has ended, and after three such attempts in a row it stops until a summary was made in the course of a commission.

A session that belongs to no project (one commission, and what followed it up) ends on the eighth day after the last commission in it ended: nothing is written to it, asked of it, woken in it or taken up again in it, and it is not summed up. What was said in it is kept until old sessions are removed (30 days), and read_session still reads it. A commission under way in it, also one that rests, keeps it alive. The sessions of projects do not end this way.

Presets and cards ​

Every session has a preset, set when the session is made; that of a member of a project or of a session of one commission can be changed afterwards (see “Changing a preset” at the end of this section), no other. Six come built in: the leader of a project is boss, a member of a project that nobody named a preset for and a session of one commission that belongs to no project are general, and a task agent started by another task agent is a worker unless the preset parameter of subagent names scout (read-only research), planner (read-only: lays out the work and does none of it) or inspector (checks finished work: it cannot write files or call capabilities, can run commands, and is told the user's rules and nothing else of what the task agent space keeps). A copy has the preset shadow, which is no template: a copy is opened by the preset of the session it was copied from, without the tools every copy is without. general and worker withhold nothing, so these kinds of session get the tools they always had; boss is without the tools that write or edit a file or run a command. A task agent has no tool that the session which started it is without, and no memory where that session has none; except the tools a template withholds from itself only (withhold_own, as boss does), which the task agents it starts keep. A preset only takes away: it withholds tools (by the existing means, a tool that is not offered and a gateway token that calls nothing), gives no memory, and caps the model requests of one run; it names no model address, key or model (model says only whose model a session follows by default, agent, advanced or inherit; the user's setting for the preset comes first). A session that may start task agents has a list of the presets it can start them with after the host's part of its system prompt (a name and one sentence on when to use it); every session then has what its own preset says of its role (general says nothing). A session whose preset withholds a tool is held to it for certain in the built-in runtime only: dsh has file and command tools of its own, which the host cannot keep from a session there. In dsh (where a new session of such a preset may be opened, and one given such a preset later goes on) it is held to its preset by what it is told (its role, and not to use those tools of dsh's) and by the host's own tools it is opened without (those the host serves to dsh, and a gateway token that calls nothing); the host goes by the preset on record all the same. The leader of a project is no exception: in dsh these words are all that keeps it from doing the work itself. What the user is asked before it opens a task agent that changes files (hand_over, start_team) is asked before dsh makes the call, as for a web search: dsh gives a call less than a minute. Only a session whose preset caps its requests is still opened in the built-in runtime alone (the host cannot count requests in dsh). Like the rest of the system prompt, this is put together when the session is first opened, after its conversation was summed up, and with its next start after its preset was changed.

Users add templates of their own: one Markdown file each, YAML front matter and the role below it, in the task agent space under templates/*.md (every project) or projects/<project>/templates/*.md (one project); the file is named after the template. Of two of a name the project's wins over the user's, and the user's over the built-in one. A template that stands in for a built-in preset and names no model: goes by the default of a template file, inherit: a planner.md of the user's has to say model: advanced to keep the advanced model the built-in planner is sent to out of the box. A task agent's tools that write files are refused in the space, and the user is asked about every command that names it, so a session does not change what it may do without the user seeing it (this is no sandbox: a command that reaches the space by a relative path is not seen, and only a preset without the shell cannot at all). An unknown field, a value outside the allowed ones and a text over its cap are errors and are never ignored; a file that is wrong still takes the place of the template it would have replaced (so a session is not opened with more than its user meant it to have), and other templates are not affected. A folder of templates that is there and cannot be read is not taken for an empty one either: no preset is used until it can be read again. The sentences that say when each template is used may come to 1,500 tokens taken together.

Every session also has a card, kept in the sessions table of the ledger: a title, what it takes, and a summary, each with who wrote it (whoever made the session, a review, the session itself, or the user). A new session has only what it takes: the session of a project takes what the project is for (or the title of its first commission), a session of one commission the title of that commission, a task agent the description it was started with. After that the review of a finished commission writes the card anew in the same model call (see the task agent space below), with no call added. The session of a project and a session of one commission may also say what they take themselves, with the optional duty of report; what a session said of itself a review no longer writes over, and a line the user wrote is never written over by anyone. What a project is for is the description of its record, which says who wrote it as well. Every row of list_sessions carries the session's preset and what it takes.

The host has three methods for a page that shows the sessions (the console page reads them through /console/board, /console/templates and /console/familiars/draft). board() returns the sessions by project, each with its card, its state (working, waiting for the user, open with nothing to do, not open, being summed up) and what it is doing (the title of the commission in hand, the item of its todo list that is in progress, the tool it called last; put together from the ledger, no model is asked), with a mark of change: a page asks with the mark it has and is told "unchanged" while nothing changed. Not every session is on it (a session of one commission that was not used in days, a task agent whose starting commission ended a while ago and a copy that is not in use are left off). templates() lists the presets there are, the wrong ones with what is wrong. draft_session() fills in the form for summoning a familiar (a new session) with one call of the summary model (a name, the title, a preset, what it takes, what the project is for, a draft of rules) from what the user wrote and the names and sizes of what the chosen folder holds; it makes nothing. The console has routes as well for adding a member to a project that is there and giving a project its leader (/console/familiars/member, /console/space/projects/leader: open_member, derive_leader), for the git worktrees the user decides on and the landing settings (/console/worktrees, /console/landing; see below), and for looking for words in what was said in a session (/console/familiars/{id}/transcript/search). None of them asks a model, but for landing a worktree again: when what it merges clashes and its commission can go back to its task agent, that task agent merges what clashed, as after any landing that clashes. Where the host asks whether another member is to do work that waits for a busy one, that question is at no session while it is asked: the colony, the board and a project in the familiar space (under the busy one, when that one is chosen) read it from /console/commissions and answer it through the commission's answer route, and what the user chose is on the timeline as an answer (not what was taken back); and where the host has that setting, /console/landing sets what becomes of such work as well (beside).

Changing a preset. The preset of a member of a project (kind line) and of a session of one commission can be changed to any preset that can be used but the leader's: NekoPowerHost.change_duty, which the console page reaches through POST /console/familiars/{id}/duty (chosen in the editor of a familiar's card). Not that of a leader, of a task agent another one started, or of a copy; whether a session leads a project or works in it is not a matter of its preset. The preset still decides what the system prompt says of the role, the list of presets and the list of tools, so a change renews the head of the session's requests. The ledger is written at once, with a duty_changed event of the commission the session's task agent is at, else of one that waits for its turn there, else of the last one filed in it (from which preset, to which, changed by whom; a session no commission was ever worked on in has none to record it with). A run under way goes on with the tools it was opened with. With the session's next start the system prompt and the tool definitions kept with it are put together anew for the preset it has then, once, and the first message of that start has one sentence of the host's: which preset it was changed from and to, that its system prompt and tools are the new one's, and that what is above was done under the old one (54 tokens; in dsh, whose system prompt is the process's and says nothing of a role, the sentence brings the new preset's role with it, and that the tools dsh has of its own for writing files and running commands are not used, 287 tokens at most; a session in dsh that is given a preset which withholds tools stays in dsh with its conversation, held to it only by these words and by the host's own tools it is opened without, which does not keep it from using what dsh offers). That one request reads nothing of the conversation from a provider's cache. The model the session is sent to changes with it: as the preset is changed the model is settled anew by the new preset (its setting, else its default); a run under way goes on with the model it was opened with, and the next start is sent to the new one. Where none can be told just now, it stays where it was. (Once a single session's model can be set by hand, one that was so set will keep it; nothing sets it yet.) From a preset that cannot change files to one that can: when the user changes it, nobody is asked (the page says before it is saved that the familiar can change files and run commands from then on); anyone else has the user asked first under open_session, as for a new member that changes files (nothing calls it that way yet). A member that can change files from then on gets its place in the project as a new one would: beside a member that changes files in the project's directory it works in a git worktree of its own. One that cannot any more no longer holds the place of the one that writes. While a worktree of it holds changes that are not landed, it is not made one that cannot change files. A card on the board has preset_was: the preset the session still works under while its preset was changed and it has not started since (null otherwise); every item of templates() has changes_files and needs_builtin (whether its sessions are held to it for certain in the built-in runtime only; they can run in dsh as well, held to it there by what they are told).

Families and leaders ​

Where a commission of hers that has no session yet goes is worked out from what it says and from what is there: the projects (name, what they are for) and the task agents of her character (their cards and what they did lately). nekopower/host/orchestrator.py decides, as pure functions; nekopower/host/families.py reads the ledger and the task agent space, asks the small model where needed, and writes down what follows. Four layers, each asked only when the one before it could not tell:

  1. Rules (no model): a project whose name occurs in the sentence has it, as before; the user asking for a new one gets a new one; a task agent named by the title on its card takes it.
  2. Retrieval (no model, under a millisecond): the sentence's own words (function words and particles left out) are held against every project and every loose task agent. When none shares two words with it, the commission is a loose one of its own. A match that is clear attaches it, unless that would make a project. A sentence in a script nothing there is written in cannot be compared and goes to the next layer.
  3. The small model (one request on the recognition tier): shown the four best matches, one line each, it says which one the sentence belongs with, and whether it follows that work up or is the same job once more, or that it belongs with none. An answer that cannot be read makes it a loose commission.
  4. The leader: a sentence that belongs with a project that has a leader goes to the leader, which says who does it. A sentence that plainly goes on with a member's own work goes to that member directly (see below).

Every decision is on record with the commission (orchestrated: the layer, the candidates with their scores, where it went, how long it took, and no sentence). The thresholds are in config/nekopower_settings.py (ORCHESTRATOR_*); they were set on the free tier against the scenarios in tests/unit/nekopower/fixtures/orchestrator_scenarios.json. A one-off request with nothing there to match costs no model request, as before.

A project is a matter, not a directory. When the same job comes up a third time (follow-ups of one piece of work do not count), the loose task agents that did it become a project, a family: a project is made with a working directory of its own under the data root, and those task agents are its members from then on, each where it worked. A review of one finished commission no longer makes a project; the name it would have given is kept and used should a family come of it.

A project's sessions are its members (kind line), which do its work, and at most one leader (kind project, preset boss). A project without a leader hands its commissions to the member that works (a general one, which may start task agents); a member takes no more work seven days after its last commission ended, and a new one is opened then. A project gets a leader when a third member would be opened, when the member a commission would go to has three under way already (at work or waiting for it), or when the user asks for one (NekoPowerHost.derive_leader); no model is asked for that. A leader is not the only one a project's work comes to: a commission that plainly goes on with a member's own work (it names the member, or shares four words or more with the member's card and what the member did lately, a word being one of Latin letters or two Chinese characters that stand together, the project's own name not counted, and two more at least than with any other member; a member that cannot change files gets it only when it is named) goes to that member directly, by a rule and with no model asked, and the leader is told what came of it with the next commission that opens in it; whatever else is the project's comes to the leader. (A setting, off as shipped, also gives a project in a git repository a leader with its first commission: LEADER_IN_GIT_REPOSITORIES.) The leader is told where the project stands with the first commission that opens in it (each member's card and state, what it did lately), and the members with every one after.

The leader does none of the work, and cannot write or edit a file or run a command itself: its preset withholds, from itself only (withhold_own), the tools that write or edit a file or run a command, and the members it hands work to keep theirs (a session that is a leader is without them whatever template stands for its preset). It keeps capability_call: what an installed plugin or a connected service does for it goes by the permission setting of its own category, and not by the leader's preset. As shipped, an entry of a plugin is allowed without asking, and the browser, the keyboard and mouse and an MCP server are asked about first; so a plugin that changes files, or anything of the others the user allowed, is not kept from the leader. It hands a commission over whole with hand_over, to a member that is there or to a new one; the commission is that member's from then on, which reports to her as any task agent does, and the leader is free for the next one and is told later what came of it. A part whose result it needs back it starts with subagent, with a preset that can change no file (a scout, a planner); one that could, with a tool or through the shell (a worker, an inspector), is refused: such work goes through hand_over (and not while task agents it started are still at work), or to a team it starts with start_team, below. One member that can change files (with a tool that writes or edits one, or through the shell) works in a project at a time, whichever character it works for, the task agents it started counted with it; a second waits its turn, and those that read only do not wait. (Two gaps are known. A member is counted by the tools it is opened with, and when its template is changed to one that can change files after it was taken from the queue, or after its leader handed work to it, it starts beside a member that is at work. And while loose task agents are made a project, there are a few waits between their being written as its members and their being counted here, in which another member of that project that can change files may start. What a session does through capability_call is not counted at all: a plugin or a connected service that changes a file of the project does so beside whichever member is at work, held back only by the permission of its own category.) A new member that can change files (an inspector, which keeps the shell, among them) that a leader opens with hand_over is opened only when the user allows it; a member that is opened for a project without a leader, and a session the user sets up, are not asked about (the permission category open_session: asked first by default, with allow and deny as the other settings). While it is asked, whether what the user says answers it is read by the model, as for any question (see the first round above): new work that says a yes or a no in passing goes on as new work.

"One member that changes files at a time", above, is about members that write in the project's directory itself. When that directory is in a git repository (and passes the probe of worktrees.py), the first member that works in a project still does so in its directory; a member that can change files and is added later (one the leader opens with hand_over, one the user adds to a project that is there) has a git worktree made for each commission as it starts, from the project's directory as it stands then (changes not committed included, under <data root>/nekopower/wt/), works there, and neither waits nor is waited for (nekopower/host/tree_work.py). A write into the project's directory with the tools that write or edit files is refused. When it is done the host merges what it changed into the project's working files (nothing is committed or staged; the worktree is of the whole repository, so what a command of its changed elsewhere in the repository is merged as well, and named in the result), once whoever works in that directory is between two steps (a member in the built-in runtime stops before its next model request; one in dsh has no such point, and is waited for until its run is over); files that clash go back to it to merge, three times at the most, and past that, or when the merge cannot be written, the worktree stays, the commission is put down as stuck, and the user chooses to try again, discard it or see to it personally (land_worktree / discard_worktree / keep_worktree). The settings can say to ask first (nothing lands until the user says so) and to have an inspector check every landing (landing_settings). Where no worktree can be made (no git repository, a full disk, eight of them in the project already) the member waits its turn as before. A leader also has start_team: it splits one commission among several task agents at once, keeps the commission, waits for them and reports once; those that change files have a worktree each, the user is asked once before they start (open_session, with how many they are and what each covers), and six work for one commission at the most. Whether what the user says while that is asked is its answer is read by the model, as for any question (see the first round). Every worktree has a row in the ledger's worktrees table, and what an earlier run left is gone through in the background once the host is in use.

In a project without a leader, work that waits for the member while it is busy and is plainly about something else need not wait: the user is asked whether another member is to do it in a git worktree of its own (TaskAgentManager._beside). "Plainly about something else" is told by words first (orchestrator.apart_from): the sentence says at least four words of its own, does not name the member, shares fewer than two with its card, what it did lately and what it is at, and neither points back at something nor adds to it. What the words tell apart then goes to the small model once (LexicalDecisionModel.goes_on_with): what goes on with the member's work after all waits for it, and so does what is not told where nobody would be asked. It is asked with an approval of its own, open_beside (detail.tool is beside, with the member that would be made): allowed for good, it allows that alone, and not the members a leader opens; no member is made until the user allows it. While it waits, whether a sentence is its answer is read by the model, as for any question. Meanwhile the commission keeps its place in the queue, waiting_user with no session, and is never put down as started. Allowed, a general member with a worktree for each commission is made and takes it; refused, it waits where it stood; should the busy member come free first, what was asked is taken back and the commission starts there in its turn. The landing settings say whether to ask (beside: ask, as shipped), open one with nobody asked (open) or let it wait as before (queue).

Sessions writing to one another, and wakes ​

A task agent can find other sessions, read what they left, write to them, ask them a question, and ask to be woken later. Five tools of the runtime do this, each carried out by the host: list_sessions looks through session names, projects and the titles of their latest commissions for words (no model is asked) and returns ten rows a page, among the 300 sessions last in use that can be written to (an older one is not found; one whose exact name or whole id is known can be given to read_session or message_session directly); read_session hands back the results and reviews of a session's latest commissions, or the places in its conversation record where some words occur, or one stretch of that record of at most 2,000 tokens (a record is never handed over whole; a session kept by dsh has results and reviews only, and its conversation record cannot be read); message_session writes a note to another session; schedule_wake asks to be started again after a delay of at least ten minutes; ask_session asks another session a question, which a temporary copy of that session's conversation answers. The copy is made only of a session with a commission under way and kept by the built-in runtime; it reads files and changes nothing, makes at most eight model requests, and is worked on as a task agent the asker started: what it uses counts with the asker's commission, it is stopped with it, and its answer comes back to the asker as a message, framed as what a model wrote from that session's conversation. The other session is not told. A session asks at most six questions an hour, which count with its notes. Sessions of every character can be found, read and written to, and each row and each note says which character the session works for. A session is named by its name or its id; where a name is how another session's id begins, or two characters each have a session of that name, the host lists the whole ids of those sessions and asks for the one that is meant. A task agent started by another task agent can find and read sessions; it writes to its own team only, asks nobody, and sets no wake.

Every turn belongs to a commission. What a commission asked for itself (a time it set, word of a note it sent) wakes that commission: when its run ends with such a request still pending, it rests: its status stays working, the ledger records since when it rests, the runtime's session is closed, and it gives up its place and its session, so later commissions of the same project are worked on meanwhile. In two cases it does not rest, its session stays open and it keeps its place, so later commissions of the same project still wait: while task agents it started are still at work (their results start its next run), and while a background command of the session is still running whose end would start its next run (closing the session would end the command). In both, a request that comes due is handed to the open session, and the commission is not queued again. One that rests is queued again when the time comes, and goes on from what was said. A report of ready, blocked or failed, and a stop, drop what it had pending. A commission that rests is not failed when the host restarts; what it waits for is on record and is picked up by the first call that does work in the host, never at startup. A note for a session goes to the commission the session is at: steered into the one at work before its next model request, waking the one that rests, kept back while one waits for the user. With no commission under way, one is filed in that session for the note (it follows up the session's last commission, takes a place, counts against the quota, asks the user where it has to, and reports to the character that session works for, along with her next turn unless its task agent asks otherwise).

Notes and wake requests are rows of the ledger (messages, wake_requests), written first and handed over afterwards, like reports. A note is handed over inside a frame the host makes at that moment: it names the session that wrote it, says that it is not from the user and carries none of the user's permissions, and puts the note between two marker lines that carry a random string made for that one occasion, every line of the note indented. What read_session returns, and what a sender is told when the turn its note began is over (notify_when_done; after 12 hours without that it is told so instead), is framed the same way. When what another session wrote is handed to a commission under way, what the user had allowed that commission "for this session" is forgotten and asked again: a note carries nobody's permissions, and the host does not leave that to the model. One note is at most 1,500 tokens; a session writes at most one note every 60 seconds to the same session, and at most 20 an hour in all, to however many sessions; at most 50 wait for one session; a commission filed for a note may have one more filed by a note of its own, and that one writes to nobody. A session may have ten wakes pending and be woken at its own asking 300 times a day. Nothing is woken while NekoPower is switched off or the free daily quota is used up; the requests stay. Stopping everything drops the notes that were not handed over yet, and ends resting commissions along with the rest; while the commissions are being stopped the host hands nothing over, what was written meanwhile is dropped when the stop is through, and a commission that was stopped writes no more notes. To hand something over, the host first puts on record which commission it is handed to and then says it to the session; it is on record as taken once the runtime reports that the text is in the session's conversation and written to its record (in dsh: once the turn that carried it is over). What another session wrote, and what the host says of a time that has come, is sent to the session marked as not the user's own words: in the built-in runtime it entitles the run to nothing that only the user's own words do (setting a goal, say). dsh does not look at that mark yet: there a run that was given only such words can still set or change a goal. What could not be said, and what a session closed without taking, is put back for the next time, except where a stop of everything came in between; what was still on its way when the host process ended is handed over again after the next start, and what a stop of everything dropped stays dropped through a restart. When the host shuts down it stops handing over first, and what was not handed over stays on record for the next start.

Files in another session's working directory, and the tool output it kept, are read without asking the user (unless reading outside the working directory is forbidden in the settings, which forbids read_session as well); its conversation record is read through read_session only, under whatever name a path leads to it, and not by searching the contents of the directory that holds it either (its names may be listed, and the directories inside it are searched as ever); nothing is written into another session's own directory, not from a working directory that happens to contain it either.

For a screen that draws the sessions of a project as a group, the host reads two things out of the ledger, with no model called and nothing stored of their own (NekoPowerHost.timeline, NekoPowerHost.waits; the console reads them through /console/timeline and /console/waits, and where to begin with /console/timeline/start). The timeline is what happened, in order, a page at a time: commissions filed, queued, started, asking the user and answered, told more, reporting, ended; task agents started and returned; questions to other sessions and their answers; work going on in a copy and handed back; rests, set times and wakes; notes between sessions and the word that their turn is over. The steps of a task agent (its tool calls, what it writes as it goes) are not in it, nor what a tool was called with, a file's content, or a setting; texts are cut to 120 tokens. A cursor is the pair of numbers read up to in events and messages, so a page goes on exactly where the last one stopped, and a reader can also start from what is on record now and take only what comes after. The waits are who waits for whom now: queued behind another commission of its session, queued for a free place, waiting for the user, waiting for word of a note, a task agent waiting for one it started, a session waiting for the answer to its question. Kinds of entries and waits are added over time; a reader passes over one it does not know. See section 17.9 of the design.

Task agent space ​

What task agents keep for later commissions is in <data root>/nekopower/task_agent_space/ (nekopower/host/space/): plain text that only the host writes, one copy per user, shared by every task agent. It holds rules the user writes (AGENTS.md), an index with one line per entry (MEMORY.md), and the entries themselves, one file each (memory/*.md): reusable findings, reflections on what went wrong, pointers to where something is found, and how a project stands. There is one such set for all projects and one per project (projects/<project>/); commissions that belong to no project are filed under _daily.

  • When a session is first opened, the rules and the two indexes are added to the host's part of its system prompt (the description of the environment and the reply language come after that part), within 2100 tokens in total, headings and notices of what was cut included; a session that is opened again keeps what it was opened with until its conversation is summed up. Nothing is added while the space holds nothing. The entries are read when they are needed: a task agent reads anything in the space with its file tools without asking and cannot write there; a shell command that points at the space's directory, or would run inside it, is put to the user every time, whatever was allowed for commands before (and stays forbidden when commands are forbidden). What it wants kept goes through its note_lesson tool; corrections and approvals from the user become task preferences instead.
  • Whether a note takes effect is told by the host, without asking a model. A task agent says how it knows what it files (verified, observed or inferred; it must say, and a note that does not is turned down) and may name files that show it (it need not). A verified note takes effect at once; an observed one needs a file that exists in the working directory of the commission or of its project (a file outside both counts only while the user has set reading outside the working directory to be always allowed); an inferred one, like an observed one with no such file, waits until a second commission files the same (a commission and the task agents it started count as one commission; the same note is one with the same title or the same text; case, white space and the punctuation at either end of a word are evened out before the two are compared, while a mark inside a word is kept, so a.b and a. b are not the same; in text that puts no spaces between words, as Chinese and Japanese do, the punctuation of a sentence goes as well, so 先核对,再提交 is the same as 先核对再提交), or until a task agent checks it and files it once more under its title as verified, or files the same text as observed with a file that exists. A note that waits is a pending entry: a file like any other that says in its front matter that it is not confirmed, in no index, so a task agent comes upon it only by searching the directory. At most 30 wait in a layer; one that nobody filed again for 90 days is deleted when the tidying of the space gets to it (the space is tidied after commissions end and looks at up to 500 entry files a time, so it may stay longer while nothing is commissioned or while there are more files than that), and one that goes may be filed again. An entry expires once every file it rests on is found to be gone (the file stays, its line leaves the index); a file that cannot be looked at just then (one outside the working directories once the user no longer allows reading there unasked, or one on a disk that does not answer) counts as neither there nor gone, and does not make the entry expire. An entry the user removed in the console is remembered so that the same note is not kept again (each layer keeps its own record, so a note removed from one project may still be kept in another, or for every project; a file deleted by hand leaves no such record; only the latest 1000 removals of a layer are remembered; and when the record cannot be written, the entry is removed all the same and may be kept again). What a review or the summary of an archived project makes is judged by the same rules, except that a global one is taken for inferred whatever files it names: the files of one project do not show that it holds for every project. Its files are kept with it for reference only: they neither have it take effect nor have it expire. A review keeps what a later commission could not tell from the files and would work differently for knowing: what went wrong and the way around it, a way that worked where the obvious one did not, what would have saved time. It leaves out what the files, the repository's own documents or their history show, and what the commission did.
  • When it works in a repository, a task agent is also given, with the message that opens each commission, a list of the files that repository keeps for agents (AGENTS.md, CLAUDE.md, .agent/rules/ and the like): paths and sizes only. The host reads none of them and never makes them part of the instructions; the task agent reads the ones that bear on its work, as reference material. There is no list when the repository keeps no such files, or when looking for them took too long (a folder on a share that does not answer): the commission starts all the same. (dsh is the exception: by itself it reads the AGENTS.md and CLAUDE.md between the working directory and the repository's root as instructions.)
  • A commission is filed under a project when the dispatched sentence or the user's own words contain the project's name. No model is asked for this. It is then worked on by a member of the project, or goes to the project's leader where it has one (see Families and leaders above): in one session a commission waits for those before it, and a member that can change files waits while another of the project is at work.
  • After a commission ends, one call of the summary model writes a review (projects/<project>/reviews/<commission id>.md), files up to two entries (a commission that was stopped is reviewed as well, and files none), and may name the project the commission belongs to; the same call writes the card of the session anew (its title, what it takes, its summary, what its project is for), leaving the lines the user wrote, and writes none for a commission that was worked on in a copy. It runs in the background once the report has been stored, and at most once per commission. A commission with fewer than three tool calls, a direct plugin call, and a task agent started by another task agent are not reviewed; a failed commission is reviewed only after it has stayed failed for a day, because it is often taken up again.
  • Tidying follows the end of a commission, at most every six hours, and never runs at startup. A project with no commission for 30 days is moved to archive/<year>/<project>/ with a summary (one model call) and comes back when a commission names it again. The transcript and the stored tool output of a session are removed 30 days after the last change of any commission worked on in it, and not while one of them is under way, waits for the user or is blocked. Host-owned working directories under the data root (30 days by default) and left-over git worktrees (held, unlanded, or kept; 14 days by default) are also cleaned automatically during tidying once their retention period passes (configurable from 1 to 365 days, guarded by file modification times and two-reading clock-jump confirmation), and can be inspected and cleaned manually from the disk space management panel (nekopower/host/storage.py); user-chosen external project directories are never removed. Last, a model looks over the entries of a layer (all projects, or one project in use) in which an entry the host made was added to or changed since the layer was last looked over, and that has at least two such entries that have not expired: one model call a layer, at most two layers a round, the layers looked over longest ago first. It only names changes, and the host checks each one before it makes it: two entries in effect that say the same thing become one; a pending one that says what one in effect says counts as seen again there, and expires with its text left out of that entry (nobody checked it, and a page the task agent read may have written it); two pending ones become one, which takes effect when two commissions have seen it by then, unless another entry, in effect or expired, has its title; an entry a newer one in effect contradicts expires for good (it does not come back for its files, only when it is filed again); an entry easily taken for another gets its title with words of its own text added, its title kept whole; and a word like "yesterday" is replaced by a date, and by nothing but a date. The model has read the pending notes, which a page may have written, so what it asks for is checked to say nothing new. An entry the user wrote is never changed; the one of two entries that is merged into the other goes, its texts being in the other, and nothing else is deleted; an entry that changed while the model looked at it is left as it is.

The session directories (<data root>/nekopower/task_agents/projects/<project>/sessions/<session id>/; a session made for a commission has that commission's id) are a separate tree on purpose: a working directory is full of links and stays where it is when the storage location is changed, while the space moves with the rest of the user's data.

dsh: the optional agent runtime ​

dsh (DeepSeek Harness) is a second agent runtime a user may download (nekopower/dsh/); the built-in one is always there. Nothing changes for a user without dsh: its modules are not imported and no process is started.

  • Which one (nekopower/host/runtimes.py). A session is given its runtime when a commission is first taken up in it, the ledger records it, and it keeps it. A new commission runs on dsh when dsh is installed, the user has not chosen "built-in only", and the commission's model is reached through an OpenAI-compatible API; otherwise it runs on the built-in runtime. A commission taken up again goes back to the runtime it began in, because only that runtime can read what was said in its session; a task agent started by a task agent runs where the one that started it runs.
  • When dsh cannot be used. If dsh does not come up, its permission guard is not confirmed to have loaded, or it opens no session for the commission, the commission runs on the built-in runtime instead and the reason is recorded in the commission's events; dsh is not tried for new commissions for the next 5 minutes. A commission that began on dsh starts over on the built-in runtime once dsh has been removed. When the dsh process exits mid-way, the commissions it was working on fail and can be taken up again.
  • How it is connected (driver.py, acp.py). dsh is a child process spoken to over standard input and output with ACP (JSON-RPC). One process carries several sessions, is started when first needed, and exits after all its sessions have been idle for 5 minutes. The driver translates ACP notifications into the same events the built-in runtime sends, so the rest of the host does not tell the two apart.
  • Model requests (forward.py, endpoint.py). dsh sends its model requests to a forwarder on the loopback address, which puts in the real model name and key, adds the parameters each provider needs, and passes them on to the address the user configured. The key is never given to dsh, and the usage of every request is read by the forwarder. The forwarder listens on a random port, each dsh process has its own random token, and any request carrying an Origin header is refused.
  • Permissions (profile.py). dsh's own sandbox is switched off; a guard shipped with its configuration makes dsh ask before every tool call, and each of those questions is decided by the same permission code of the host. A call through the capability gateway is ruled on, and the user asked, before it is sent; the gateway does not ask again when the call arrives.
  • The host's tools (host_tools.py). Reporting, noting lessons, web search and fetch, and child task agents are offered to dsh as an MCP service, from the same definitions the built-in runtime uses; dsh's own web search and fetch are switched off, so a page is fetched from public addresses only, as on the built-in runtime. The capability gateway is mounted into dsh directly over MCP.
  • Where it is installed (install.py). <data root>/nekopower/dsh/ holds the program, dsh's own configuration and its session logs; it does not move with a storage migration. The version downloaded is pinned and the file is checked against its sha256 and size.
  • Adding dsh plugins (plugin_command.py). dsh plugin add hands its arguments to a pnpm on the computer and brings none of its own. Each time the host starts dsh it writes a neko-dsh-plugin command into <data root>/nekopower/dsh/bin/ (on Windows only the .cmd is there; the PowerShell script it runs is in bin/lib/) and puts that directory on the dsh process's PATH, so a task agent on dsh adds a plugin with neko-dsh-plugin add <package>. The first time, it fetches a pnpm that needs no Node.js, from the npm registry or npmmirror when that does not answer, checked by size and SHA-256. The plugin is fetched from the registry that delivered pnpm; when that fails, each registry after it is tried. Local commands such as list and remove ask no registry once pnpm is there. pnpm's store and cache are in nekopower/dsh/pnpm/, which an uninstall removes. A plugin runs inside dsh with all its rights and no sandbox, so the user is told and agrees before one is added: the task agent's instructions say so, and when the command is asked about, the permission question and the answer box in the interface state it. If the user has allowed commands for the session or always, the command is not asked about, and only the instructions remain. The tools a plugin brings fall under "other", whose permission setting decides whether they are asked about (by default they are not). A plugin is loaded when a dsh process starts, so it is there from the next one on. There is no pnpm for macOS on Intel, where plugins cannot be added.

A few things differ from the built-in runtime on dsh: something added mid-way reaches the task agent only when its current stretch of work has ended; a reply arrives whole rather than word by word; one call through the capability gateway may take 60 seconds at most; there is no tool that asks the user and waits in place, so a report that waits for an answer is used instead; and dsh sums a conversation up on its own, so what a session was told at first is not told again after that; only under the stock configuration with first-turn mounted device tools does its guard report a compaction to refresh the device list and clear loaded built-in tool groups, while pure on-demand sessions without mounted devices are still not reported and do not hand built-in tool groups over anew.

Capability gateway and permissions ​

Besides its own file and command tools, a task agent reaches everything through the capability gateway (nekopower/host/gateway.py): an MCP service on the loopback address, started when the first task agent needs it, with one token per commission. It serves:

  • plugin entries that are visible to routing, one tool each, called through the same /runs code as a direct call;
  • the tools of MCP servers configured in the mcp_adapter plugin;
  • the built-in tools for keyboard-and-mouse control and for browser control, described in the next section. Only task agents can call them.

A task agent's tool list holds two tools of the gateway and no others, whichever commission it works on and whether or not anything can be called at the moment: capability_search finds a capability by what it does, and capability_call calls one by name. A plugin that is installed, or a browser that is switched on, while a session lasts is reached through them without the session's tool list changing. The entries the task brain picked for a commission are told, with their names and arguments, in the message that opens the commission.

Permissions are stored in <data root>/nekopower/permissions.json. Each category is first_ask, always_ask, allow, or deny. By default, plugin entries and file access inside the working directory are allowed, while reading or writing outside the working directory, commands, keyboard-and-mouse, the browser, and each MCP server ask on first use. deny also keeps a plugin or an MCP server out of direct calls. For keyboard-and-mouse and the browser, an approval given for a single request lasts until the task agent's current run is over, because their tools are single clicks and key presses.

Built-in tools: keyboard and mouse, browser ​

Keyboard-and-mouse control and browser control are two groups of built-in tools (nekopower/builtin/, in the Agent process). A task agent calls them one step at a time from its own loop, next to its file and command tools, and sees the result of each step before it decides the next. Neither group runs a loop of its own, and no call to them asks a model. The definitions the model sees are in config/prompts/prompts_nekopower_builtin.py. The gateway does not list them among a task agent's tools: every request carries one line about each group, with the call the group is started with (open a page, take a screenshot). That first call is made through capability_call and is carried out; when it goes well its answer brings, in front of what the call returned, how the group is used and the definitions of its tools (at most 2000 tokens a group). From then on the tools are called by name through capability_call. A task that does not start with that call loads the group through capability_search with group. Any other call made before its group was handed over is not carried out and is answered with the group. Once the runtime has summed the conversation up, a group handed over before that is handed over again the next time one of its tools is called.

  • Keyboard and mouse. One tool, computer, whose action argument is screenshot, ui_tree, click, move, drag, scroll, type, key, or wait. On Windows, ui_tree enumerates desktop controls via Windows UI Automation (nekopower/builtin/uia.py) so actions can target controls by uid (and to_uid for drag), falling back to screenshots and 0–999 normalized coordinates (the default on non-Windows platforms). Actions other than plain ui_tree return a screenshot taken after the action, and coordinates outside 0–999 are refused.
  • Browser. Seventeen tools named browser_*: navigate, take a snapshot, click, hover, fill a field, fill a form, type text, press a key, take a screenshot, list, select, open and close pages, wait for text, handle a dialog, upload a file (browser_upload_file), and drag (browser_drag). A page is read as a text snapshot of its accessibility tree (including cross-process iframes via Target.setAutoAttach) in which every element carries a uid, and an action names its element by that uid. A uid that is not in the latest snapshot is refused. A snapshot is cut at 3000 tokens and says where to read on from. Only http:// and https:// addresses can be opened.

The browser is one the user has installed: Chrome, Edge, Brave, or Chromium, in that order; on Windows the system's default browser comes first when it is one of them. It is driven over its debugging protocol (the Chrome DevTools Protocol), without a browser automation library: a browser the application starts itself prefers a portless anonymous pipe (--remote-debugging-pipe) and falls back to a loopback WebSocket when pipes are unavailable; attaching to an existing browser or reusing a port file uses WebSocket. By default it is started with a profile directory of its own, <data root>/nekopower/browser_profile: a site logged into there stays logged in, and the user's everyday logins are not available. The user can instead have the tools drive the browser they are already using. That needs Chrome 144 or later, the user switches remote debugging on at chrome://inspect/#remote-debugging, and the browser asks for approval at each connection; when no path is fixed, attach mode checks all detected browsers, and when a path is configured it infers that browser's profile directories. The choice is kept in <data root>/nekopower/browser.json; a browser installed in an unusual place is named there as executable, or with the NEKO_BROWSER_PATH environment variable.

A browser the tools started is not closed between tasks: when a task ends or is stopped, its window and pages stay, and the next task goes on with the same browser. The application closes it only when the browser settings are saved with a change, or when it quits. When every task is stopped (end_all), when the browser tools or the Agent master switch are switched off, or when a switch is put off automatically because the agent model is not configured, a browser that has a window stays open, so the user can go on reading what is in it; no call of the browser tools is carried out while they are off. One that was started without a window (headless) is closed in all of these cases, as before. The application stays connected to a browser it leaves open, so that browser still cannot reach the application's own service ports. A browser the user is already using is never closed by the application; it only disconnects.

When the user closes that window themselves, the application does not open it again by itself. The next time a task agent calls a browser tool, the task waits for the user (as it does for a permission), and they are asked whether the browser may be opened again: allow it this once, or refuse. This is asked each time the browser was closed, whatever the permission setting for the browser is, and there is no time limit on the answer. A browser that crashed cannot be told from one that was closed, and is asked about in the same way.

No browser is shipped with the application and none is downloaded at start. Playwright is a test dependency only, and browser-use is not a dependency. When no usable browser is installed, browser control is not ready and reports that none was found (AGENT_BROWSER_NOT_FOUND).

computer and browser_take_screenshot return pictures, so they are offered only to a task agent whose model can see pictures. A model counts as able to until its provider refuses a request because it carried a picture; that request is sent once more without pictures, and the model is recorded in <data root>/nekopower/model_capabilities.json. A task agent's context keeps the three most recent screenshots, counted across all of these tools together.

There is one desktop, and one browser shared across tabs. For the desktop (keyboard_mouse), a commission occupies the group exclusively from its first call until its task agent's run ends, it starts waiting for the user, or it ends (shared with the task agents it started); another commission that needs the desktop waits up to 120 seconds and is then told which commission has it. For the browser (browser), multiple commissions can occupy the group concurrently on isolated tabs owned by each top-level commission, while calls within the same owner run sequentially. When the browser cannot open new tabs (for example, when it rejects Target.createTarget), it has a single page that belongs to one commission at a time; a concurrent commission's browser call fails with a "single page in use" error until that page is released.

When a commission begins or stops occupying a group, the Agent process sends a builtin_activity event, and the Main Server forwards it to every connected page as an agent_builtin_activity WebSocket message. The pages pass it on as a neko-agent-builtin-activity DOM event and draw nothing themselves. GET /api/agent/builtin/activity returns the current occupations, and POST /api/agent/builtin/stop stops the commission that holds one; both are described in Agent REST API.

Reports back to the conversation ​

Every report is written to the ledger's outbox first and then sent to the Main Server over ZeroMQ. A failed send is retried after one second, doubling up to five minutes. Reports that an earlier process left unsent go out when the host is next used.

Outbox kindMeaningSent as
task_resultHow a commission endedtask_result event
questionA commission waits for the user's answer or approvalproactive_message event
correctionThe second round or the turn check found that what the character said does not holdproactive_message event
receiptConclusion of a first round that outlasted its one-second budgetproactive_message event

The Main Server queues a report on the matching LLMSessionManager and delivers it in one of the existing modes: proactive wakes the character to speak, passive rides along with her next turn, and a silent result is not reported to her at all. Text sessions can deliver at once; voice sessions may defer until an injection or hot-swap boundary. The turn in which she relays a report is not sent to the turn check below.

A dialogue session is replaced every few turns and keeps no task record. Each new session calls GET /nekopower/brief and is told what is still under way. Every change of a commission is also sent as a task_update event for the Task HUD.

What a commission that waits for the user asks can also be answered on the pages, without her passing it on. While a commission waits, task_update carries what it asks (question; a request for approval has one more line, line, which says what is to be allowed in the commission's language, and line_cut says the command or path in it is not whole), and the task HUD shows buttons and a line for words inside the card. The report of the question hands the same parts to the main server, and the chat window shows a card for it (a nekopower_question frame); when the commission stops waiting another frame follows, with no question and the id of the one it asked, and the card is closed. The questions of a task agent's own task agent travel in these two frames as well (the HUD does not list those). A page that connects reads what waits right now with GET /api/agent/questions. An answer goes to POST /api/agent/commissions/{id}/answer, which is passed on as it is to the agent process's /console/commissions/{id}/answer: choice (one of the four answers to a request for approval; yes or no to a plugin's request for confirmation), text, selected (the options of ask_user_question that were picked, by where each question stands: "0", "1"), and note (a sentence added to a choice, passed on to the task agent as /tell would once the answer is in; note_taken says whether it was), all against question_id; a question that was answered, taken back or replaced meanwhile answers 409. The small places (the HUD, the compact chat, above a familiar's head in the colony) do not offer "always allow" or "allow for this task" straight away: not while the command or path is not shown whole, and the card above a head offers only "just this once" and "deny".

Turn check ​

When a turn that the user started ends and the character called no tool that acts (memory recall, knowledge lookup, and query_tasks do not count), main_logic/cross_server.py sends a turn_check_request with the user's words and her reply. publish_turn_check_reliably() waits briefly for turn_check_ack and retries once. Turns she started herself, agent-callback turns, and image-only turns are not sent.

The host first applies a gate that costs nothing: the turn is skipped when the input-time intent score is known and below 0.2, no plugin keyword occurs in the user's words, and every routable plugin declares keywords. A turn that passes costs one small-model call with one of four verdicts.

VerdictWhat follows
Nothing to do, or she declined on purposeNothing
She said it cannot be done, but local matching finds a wayShe is told and corrects herself
She agreed to do it but did not dispatchIt is dispatched for her, and she is told
She said it is done, but the ledger has no such commissionShe is told and corrects herself

The check has no authority of its own. A commission is filed only because the character dispatched it or agreed out loud.

Transport map ​

HTTP carries control and queries on 127.0.0.1:48915; the embedded plugin service listens on 127.0.0.1:48916. Events use synchronous ZeroMQ sockets on background receive threads, which also works with the Windows Proactor event loop.

Default addressPatternDirectionPurpose
tcp://127.0.0.1:48961PUB / SUBMain → AgentSession and lifecycle events
tcp://127.0.0.1:48963PUSH / PULLMain → AgentReliable turn_check_request queue
tcp://127.0.0.1:48962PUSH / PULLAgent → MainACKs, status, task updates, and reports

The ports can be overridden with NEKO_ZMQ_SESSION_PUB_PORT, NEKO_ZMQ_ANALYZE_PUSH_PORT, and NEKO_ZMQ_AGENT_PUSH_PORT. Agent → Main events have no HTTP fallback. Reports wait in the outbox until the bridge takes them; task_update and status events are best effort.

Capability state ​

The authoritative state is exposed through Main Server proxies under /api/agent/*. The frontend changes state through /api/agent/command and refreshes it through /api/agent/state; it should not treat local checkbox state as authoritative.

StateMeaning
analyzer_enabled / UI agent_enabledMaster switch
computer_use_enabledKeyboard-and-mouse tools for task agents
browser_use_enabledBrowser tools for task agents
user_plugin_enabledPlugin entries, for direct calls and through the gateway

Managers and the Agent Server initialize these switches off. Persisted runtime intent is restored after the first real greeting_check, so "off at construction" does not reset the user's choice on every page load. Keyboard-and-mouse and browser control additionally require the agent model to be configured (address, model and key); the model is not sent a request to check it (app/agent_server/capabilities.py). A key that is wrong, or an account with no quota or balance left, shows when a task agent first uses the model: the task fails and says so in plain words (model_failure_kind in nekopower/runtime/model.py). Keyboard-and-mouse also requires that input can be sent on this machine, and browser control that a usable browser is installed.

Stopping, limits, and restarts ​

  • Stopping writes cancelled first, then cancels the plugin run (POST /runs/{run_id}/cancel on the plugin service) or closes the task agent's session. POST /admin/control with end_all, and turning the master switch off, stop every commission under way.
  • The desktop is occupied by one commission at a time, while the browser allows multiple commissions to run concurrently on isolated tabs (calls within the same owner are carried out one after the other), as described under the built-in tools. Stopping a commission cancels its call under way and frees what it occupied. A click or a navigation that was already sent is not undone.
  • A plugin may return deferred: true. The commission stays working until /api/agent/tasks/{task_id}/complete is called, or fails after one hour.
  • When a host starts after a restart, commissions the previous process left queued, working, or waiting_user are marked failed and reported with the character's next turn. Deferred commissions are kept until their deadline, and commissions that rest are kept as they are: what they wait for is on record.
  • The Agent process keeps ended tasks in its HUD view for five minutes.

Implementation map ​

ConcernCurrent implementation
Task tools and their handlersmain_logic/core/tool_calling.py, config/prompts/prompts_task_tools.py
Turn-end trigger for the turn checkmain_logic/cross_server.py
ZeroMQ bridge and ACK/retrymain_logic/agent_event_bus.py
Dispatch, query, turn checknekopower/host/task_brain.py
Plugin selection and the decision modelnekopower/host/selection.py, decision.py
Ledger, outbox, reportsnekopower/host/ledger.py, outbox.py, reports.py
Where a new commission goes, families, leaders and membersnekopower/host/orchestrator.py, families.py, tests/unit/nekopower/fixtures/orchestrator_scenarios.json
Presets and templates, cards, the board, the form for summoning a familiarnekopower/host/templates.py, board.py, drafts.py, config/prompts/prompts_nekopower_presets.py
Notes between sessions, wakes, reading another session's recordnekopower/host/wakes.py, records.py, task_agents/messaging.py, config/prompts/prompts_nekopower_sessions.py
What happened between sessions, who waits for whom (read only)nekopower/host/timeline.py
Task agents and the agent runtimenekopower/host/task_agents/, nekopower/runtime/
dsh: the optional agent runtime and the choice of runtimenekopower/dsh/, nekopower/host/runtimes.py, config/prompts/prompts_nekopower_dsh.py
Task agent space: entries, indexes, reviews, archiving, disk space cleanupnekopower/host/space/, space_keeper.py, storage.py, config/prompts/prompts_nekopower_space.py
Capability list, gateway, permissionsnekopower/host/capabilities.py, gateway.py, permissions.py
Keyboard-and-mouse and browser toolsnekopower/builtin/, config/prompts/prompts_nekopower_builtin.py
Occupation of the desktop and the browser; which models see picturesnekopower/host/leases.py, model_capabilities.py
Calls to plugin entries (/runs)nekopower/host/plugin_runs.py
Host mounting, HUD view, switches and events of the built-in tools, whether they can be usedapp/agent_server/nekopower_mount.py, nekopower_builtins.py, capabilities.py
Agent lifecycle and HTTP APIapp/agent_server/api_runtime.py, api_routes.py
Result delivery to chatmain_logic/core/proactive.py

See Agent REST API for the public control endpoints and Agent Server API for the internal routes.