Repository navigation
Conversation
…the system prompt (v1.8.0) Official answer (asked by the owner): a script may create a NEW agent in the Host agent configuration - "adding one is fine as long as existing agent configuration is not modified". This PR does exactly that, and nothing else. What it does - New module miniapp/node/agentprov.mjs: locates the Host agent directory (ONLY from paths the Host itself returns - session workspace / agents() list; never derived from dataDir), renders agent.md (her character sheet + the three identity sections + the frontmatter the Host parses), and writes it as ONE new file. - New module miniapp/node/identity.mjs: the single reader for the identity sheet, shared by the per-message copy and the agent file (one judgement, one place). - agentpick.mjs: priority is now explicit > the user own mmx > ours > default agent. - server.mjs: when no dedicated agent exists, the runtime adds ours and moves her session onto it (only while she has not spoken yet, so no history is lost); any failure degrades silently to the previous behaviour (the identity sheet travels with the message). Three hard lines 1. Only ADD <agent dir>/mmx-octopus-agent/agent.md - no existing agent is modified; if the name is taken by an agent that is not ours we write nothing and do not use it. 2. The Host agent directory is located only from Host-returned paths; if it cannot be identified we write nothing (no fallback guess). 3. Every failure (unknown directory / name taken / write error / verify error) returns an error result - it never throws and never blocks her from talking. Disclosure Both READMEs now state exactly which file is written, what is in it, that nothing else is touched, how it is written (atomic, once, only when absent) and how to remove it. Verification - Node self-test: 848 checks, 0 failures (new group "round 44", 7 checks, including 4 negative injections: dropping the "never touch an existing file" guard / pointing the target at the user own agent / deriving the directory from dataDir / breaking the agent priority). - The previous "never writes a Host file" checks were rewritten as behaviour assertions - they now assert that the only module allowed to touch an agent file is agentprov.mjs, and that its target is the one agent we own.
…ritten in place
The previous wording ("how to turn it off") was misleading: deleting the file does not
keep it away, the runtime adds it again on the next start. Both READMEs now state the
actual behaviour:
- the file is never rewritten in place, so after a package upgrade the old character
sheet stays there until the directory is deleted (then it is added again with the
current sheet);
- to not have this agent at all, create an agent of your own named mmx - the plugin
prefers it and adds nothing.
Also adds the negative judgement for the rename route (changing her name writes only
state.json and never touches an agent file) to the internal self-test, and states the
judgement in the PR body.
MyPrototypeWhat
left a comment
There was a problem hiding this comment.
Thanks for the update. This push only touches the README section on removing the agent, so the points below still apply.
A dedicated agent is a reasonable way to keep the persona in the system prompt, and the create-only write, the ownership marker and the refusal to reuse a taken name are all good. One thing needs to change before it can merge.
Must fix
1. The agent directory is found by guessing, and the guess can land in a user's project. agentsRootCandidates() (miniapp/node/agentprov.mjs:107-138) collects every path-like string from the session detail and the agent list. The second pass (agentprov.mjs:128-129) walks up to eight levels from those paths and takes the first folder named agents. On the default agent the session workspace can be a user project, so ~/code/agents/foo would get a new mmx-octopus-agent/agent.md. That contradicts "not your project files" in README.md:133.
Please accept only a root you can prove: the miniapps/<plugin-id> derivation from the first pass, or one derived from context.dataDir as in 1.4.0. Drop the walk-up, and write nothing if neither applies (you already handle that case).
2. The version doesn't match. Both READMEs still say 1.7.0 (README.md:8, README.zh-CN.md:7), while plugin.json and package.json say 1.8.0.
Optional
- With no agent directory and no session,
ensureOwnAgent()creates an extra session on the default agent just to probe paths (miniapp/node/server.mjs:1627). It may show up in the user's session list, so mention it in the README or reuse it as her session. npm run checkwarns aboutprocess.stdout.writeinagentprov.mjs. Moving the CLI into a script outsideminiapp/nodewould clear it.- Opting out currently means creating an empty
mmxagent by hand. A setting in the panel would be easier.
Verified
- Idle talk still defaults to off (
state.mjs:352). - The new file holds only the packaged persona and identity sections, and the README says they go into the system prompt.
- Other writes stay under
context.dataDir, and no existingagent.mdorAGENTS.mdis modified. npm run checkpasses with one warning (87 tests).
Happy to take another look once the directory lookup is tightened.
Addresses the review on MiniMax-AI#107. Must fix 1 - the agent directory must be provable, not guessed. agentsRootCandidates() used to collect every path-like string and then walk up to eight levels looking for a folder named "agents". On the default agent the session workspace can be a user project, so ~/code/agents/foo would have received a new mmx-octopus-agent/agent.md - which contradicts "not your project files" in the README. The root now comes from exactly one shape: the workspace of a session the plugin itself created. The Host sets that workspace to the Mini App's own agent directory (<agents root>/<agent>/miniapps/<plugin-id>), and the plugin takes its parent. The walk-up is gone, the agent list is no longer a path source, and context.dataDir is still never used to derive it. When the directory cannot be identified, nothing is written and the per-turn character sheet keeps working. Must fix 2 - both READMEs said 1.7.0 while plugin.json and package.json said 1.8.0; they now say 1.8.0. Optional - the probe session is reused as her session instead of creating a second one, and the README documents it; the CLI moved to miniapp/scripts/agentprov-cli.mjs, which clears the stdout warning from npm run check (now 0 warnings for this package, 87/87 tests pass).
|
Thanks for the review - both Must fixes are addressed in |
…ites nothing The review asked how a user could opt out of "the plugin adds an agent to the Host". The only answer was "create an empty agent named mmx by hand" — not easier. The panel now has a two-way choice: - "use an existing agent" (the default) — the plugin adds nothing and writes not a single byte outside its own dataDir; - "create a dedicated agent" — only then does it add <agents root>/mmx-octopus-agent/agent.md. If that fails (name taken, the directory cannot be proven, the write fails), the panel says why instead of silently falling back. Also fixes an inconsistency found while writing the disclosure: in the dedicated tier the agent name was handed to the picker without checking that it was really ours, so a foreign agent that happened to own the name mmx-octopus-agent could be used as if it were ours, while the panel said "could not create it, continuing with an existing agent".
|
Thanks for the review - the opt-out item (Optional 3) is now implemented in
Both READMEs now state that nothing is added by default and that the file is only created after picking create a dedicated agent. The old workaround (create an agent named Two things worth flagging:
Self-test: 858 checks, 0 failures (new group round 45, 7 checks, 2 negative injections; the judgements were falsified against the real code as well). |
The choice was only in the settings panel, so a first-time user never met it. It now sits on the opening card as well - pick the tier first, then her name and how she addresses you - and it goes out in the same submission. Both places share one rendering (the `data-agentmode-group` marker plus a single `paintAgentMode` selector) so the two copies cannot drift, and while the opening card is open a snapshot refresh leaves the pending pick alone. Self-test: 865 checks, 0 failures (new group *round 46*, 7 checks). Every check was falsified against the real code.
|
Follow-up to the review thread: the choice is now asked on first run as well (commit The two-way choice used to sit only in the settings panel, so a first-time user never met it. The opening card now asks for the tier first (use an existing agent / create a dedicated agent), then for her name and how she addresses you, and all three go out in one submission. Since the same control now exists in two places, both share one rendering (a Self-test: 865 checks, 0 failures (new group round 46, 7 checks, each falsified against the real code). |
The product default is now "create a dedicated agent" (boss, 2026-11-04): her character sheet then lives in that agent's system prompt, so her personality is crisper and her replies more lifelike. The two-way choice stays: pick "use an existing agent" and the plugin writes not a single byte outside its own data directory. The point of this change is not one constant: "what the default is" now lives in exactly one place (DEFAULT_AGENT_MODE + normalizeAgentMode in node/agentpick.mjs). The state machine, the server route and the panel all go through it; the page reads the value injected by the server, so nobody writes a second default that can drift. The READMEs now say the same thing: by default the plugin adds one agent file, and the "use an existing agent" tier is the zero-write opt-out.
Correction: the product default is now create a dedicated agent (commit
|
Real-machine verification of both tiers (2026-11-04)The two tiers were exercised on a live install - clicking in the panel, not only reading the code:
One timing detail, stated plainly because it is real behaviour and not a defect: switching the tier records the choice; the file is created on the next turn that goes through the session path (a message, idle talk, a diary entry). Creating it at the moment of the click is not generally possible, because the Host agent directory can only be proven from a session the plugin created itself - a fresh install has none yet, so it would fail with could not identify the Host agent directory and then create the file on the next turn anyway. Deferring it is what actually succeeds. |
What this PR does (v1.8.0)
Adds one agent of our own to the Host agent configuration, so that the MMX Octopus character sheet can live in an agent system prompt instead of only inside the message.
This follows the official answer to the owner question: a script may create a new agent in the mcode agent configuration; adding one should be fine as long as existing agent configuration is not modified. This PR does exactly that, and nothing else.
Product default changed: a dedicated agent is now the default (2026-11-04, commit
0349167)This corrects the statements below. Earlier follow-ups said the default adds nothing and
writes not a single byte outside the plugin data directory. That is no longer the default.
The product default is now create a dedicated agent, because that is what gives the best
experience: her character sheet then lives in that agent's system prompt, so her personality
is crisper and her replies more lifelike, instead of travelling inside every message where
the Host context compaction may drop it.
What did not change - the opt-out is still one click. The two-way choice stays, it is still
asked on first run, and picking use an existing agent still means the plugin writes not a
single byte outside its own data directory and never touches the agent it could have added.
The zero-write behaviour is now the opt-out rather than the default.
The disclosure follows. Both READMEs now say that by default the plugin adds one agent
file, and that the use an existing agent tier is the zero-write opt-out. The three hard lines
are unchanged: still only add (never modify an existing agent), still never guessed
(only the one provable path), still never throws (every failure degrades and says why).
What was actually changed in the code. Not one constant - "what the default is" now lives
in exactly one place:
DEFAULT_AGENT_MODEandnormalizeAgentModeinnode/agentpick.mjs.The state machine, the server route and the panel all go through it; the page reads the value
the server injects, so no second default can drift. Before this, that rule was written in nine
places, and the
server.mjsfallback even pointed the other way.Self-test: 875 checks, 0 failures (new group round 47, 10 checks). The checks judge the
assembled behaviour, not source text: they run the real
PetState, they POST to the real/api/agent-moderoute, and they execute the panel's own normalization function. Sixfalsification experiments all turn the judgement red - including the one that matters most:
hard-coding the default in the page (instead of reading the injected value) is caught.
One weakness of mine was caught while doing this: the first version of the page check compared
the page result with the server result, and since both defaults were
own, a page thathard-coded the default still passed - the check was fake. It now requires the page to follow
the injected value, so the two can no longer be told apart by accident.
Review follow-up (2026-11-04, commit
e7415ab)agents- and asserts that not a single byte is written there; re-inserting the old walk-up into the module turns exactly that check red and names the path it would have written.1.8.0, matchingplugin.jsonandpackage.json.npm run check. The CLI moved tominiapp/scripts/agentprov-cli.mjs: the Host scansminiapp/node/**as runtime code, where stdout writes warn.node scripts/validate.mjsnow reportsplugins/antianqi/mmx-octopus: OKwith no warnings, and 87/87 tests pass.ba3bb32- see the second review follow-up below. The panel now has a two-way choice instead of a switch.Review follow-up (2026-11-04, commit
ba3bb32) - Optional 3: the choice lives in the panelThe review asked how a user could opt out; the only answer was create an empty agent named
mmxby hand - not easier. The panel now has a two-way choice:<Host agent dir>/mmx-octopus-agent/agent.mdis created, exactly as described above. If that cannot be done (name taken / directory not provable / write or verify failed), the panel says why instead of silently falling back.Two details worth flagging:
Both READMEs state that by default one agent file is added, that use an existing agent is the zero-write opt-out, and that the old workaround (create an agent named⚠️ The "by default nothing is added" wording in this paragraph was true for commit
mmxby hand) is gone - the panel is the only entry point.ba3bb32and was corrected in commit0349167(see the section above).First run asks the same choice (2026-11-04, commit
de64134)The two-way choice used to live only in the settings panel, so a first-time user never met it. It is now asked on first run, on the opening card:
Two details worth noting:
data-agentmode-groupmarker plus a singlepaintAgentModeselector) - the two copies cannot drift.Self-test at that point: 865 checks, 0 failures (new group round 46, 7 checks); the total has since grown to 875 - see below. One of the falsification experiments exposed a weak check of mine: it only counted how often the shared marker appears in the file, so taking it off one of the two places still passed - it now checks each container separately.
Why
message.appendinto the input box / the Agent session API) - there is no "inject a system prompt" channel.The three hard lines
<Host agent dir>/mmx-octopus-agent/agent.md. No existing agent is modified. If that name is already taken by an agent that is not ours, the plugin writes nothing and does not use it - she keeps working on the default agent.<agents root>/<agent>/miniapps/<plugin-id>), and the plugin takes its parent. It is never guessed - no walk-up looking for a folder namedagents, and never derived fromdataDir. If it cannot be identified, the plugin writes nothing.What is never written, at any time
<Host agent dir>/mmx-octopus-agent/agent.mdon first run - that is the one and only file it writes outside its data directory. Everything below is about what is never written, rewritten or touched.state.json. The/api/namingroute touches the plugin data directory and nothing else; the agent file is not opened, not rewritten, and its display name does not follow the setting.agentprov.mjs, and its only target is the one agent file above.agentscan never be written into.Behaviour
mmxagent > the default agent (ours does not take part at all); create a dedicated agent (the default): explicitly chosen > ours > the user ownmmxagent > the default agent. If you already have an agent namedmmx, nothing of yours is touched either way.Disclosure (both READMEs)
The English and Chinese READMEs now state which file is written, what is in it, that nothing else is touched, how the directory is found, how it is written, how to remove it and how to pick up a new version (delete the directory - the file itself is never rewritten in place).
Verified on a real machine (2026-11-04)
The two tiers were exercised on a live install - clicking in the panel, not only reading the code:
<Host agent dir>/mmx-octopus-agent/agent.md(9548 bytes, with the<!-- mmx-octopus:self-agent -->marker in it), and her session then ran onagentName: mmx-octopus-agent- the Host listed it with display name 小章鱼, and the whole character sheet (persona, appearance, and the 28 speech rules) was in that agent`s system prompt.One timing detail, stated plainly because it is a real behaviour and not a defect: switching the tier records the choice; the file is created on the next turn that goes through the session path (a message, idle talk, a diary entry). Creating it at the moment of the click is not possible in general, because the Host agent directory can only be proven from a session the plugin created itself - a fresh install has no such session yet, so it would have to fail with could not identify the Host agent directory and then create the file on the next turn anyway. Deferring it is therefore the behaviour that actually succeeds.
Verification
mmxagent,dataDir,agents(<tmp>/code/agents/foo): not a single byte may be written there.agentprov.mjs, and its target must be the one agent we own.mmx-octopus-agentis never used as ours. Two negative injections turn it red (changing the default tier / breaking the tier guard).server.mjsturns exactly one check red and names it; breaking the pure function behind the agent choice turns exactly one check red; breaking the server side of that same choice does too.PetStateis run, the real route is POSTed to, and the panel's own function is executed.Known limits
0349167, see the section above). To keep the v1.7.0 zero-write behaviour, pick use an existing agent in the panel - then the plugin writes nothing outside its own data directory and never touches the agent it could have added.mmx-octopus-agent(display name 小章鱼).