Repository navigation
v1.0.1
Security release. It also publishes the agent test layer that was merged into main after v1.0.0 (launch profiles, bounded input trials, a persistent knowledge graph; pull requests #17 to #39).
Breaking for MCP clients that write. A client that changes a target (memory writes, breakpoints, patches, scripts, native calls, prompts) must now be started with cortex.exe mcp --allow-writes. A client that only saves Cortex's own records (project notes, addresses, pointer paths, knowledge, session facts, the cortex_test_* journals, catalog and reports) needs --allow-state, which cannot change the target; --allow-writes includes it. Clients that only observe and analyze are unaffected. See README.md and docs/mcp.md for the three configurations.
Security
The distributed v1.0.0 is affected: through mutation_permission (a boolean the client wrote itself), batch_run, cortex_attach and cortex/private/route, an AI client could change a target, or load the runtime into it, without the person having allowed writes. This was found by auditing the MCP path and reproduced against the real cortex.exe mcp. It is fixed as follows.
- Write authority now comes from the person, not the model.
cortex.exe mcp(and thecortex_host mcpbridge) take--allow-writes; without it every call that changes the target is refused withwrite_authority_required. The flag reaches the runtime on the authenticated pipe envelope, never inside a tool call.mutation_permission=trueon the call is still required, as a declaration of intent, and no longer sufficient. The desktop supplies its own authority from the Read-only / Writes allowed switch. This is a behaviour change: an MCP client that wrote before must now be started with--allow-writes. - A narrower authority for Cortex's own records:
--allow-state. Saving project notes, addresses, pointer paths, knowledge and facts (project_note_add,project_knowledge_put,re_session_fact_set, ...) and the test journals, catalog and reports (cortex_test_report,cortex_test_step_*,cortex_test_catalog_save, ...) is a new risk class,state. It needsmutation_permissionand either--allow-stateor--allow-writes, and is refused withstate_authority_requiredotherwise. It cannot change the target:--allow-statealone still refuses every write to the target. Without it, an agent cannot plant records for a later session to read. A client that saved knowledge before must now be started with--allow-state. batch_runno longer bypasses the permission. It was classed as an analysis although itsopswrite memory, freeze values and patch code. It is now classified from its operations against an allowlist, an unknown or computed operation is refused, and the same classification is re-checked after$from_stepreferences are resolved so a reference cannot make an authorized step riskier.cortex_attach(and--pid/--process) no longer inject without authority. Loading the runtime puts code in the target; without--allow-writesthe server connects only to a runtime that is already there (for example loaded withcortex.exe inject <pid>).- The private desktop channel is closed to MCP clients. A raw
cortex/private/routemessage sent by an MCP client was forwarded to the runtime, which ran any native route with no check. The server now forwards onlyinitialize,ping,server/discover,tools/list,tools/callandnotifications/*, and the runtime accepts a private route only from the desktop's own adapter. scan_new/scan_nextwithpause_process, and allprompt_*tools, are now control operations that need authority.- A tool that no rule classifies is refused. Every listed tool now needs an explicit risk class; a tool with none is
unclassifiedand is refused withtool_not_classifiedwhatever authority the caller holds (before, an unknown name defaulted toanalyze).tests/fixtures/mcp_tool_risks.jsonrecords the class of every primitive tool and a test fails if one changes or is missing. - Host tools added after v1.0.0 are classified. Every
cortex_launch,cortex_test_*andcortex_knowledge_*tool is listed intools/listasread_onlyor ashost_control; the ones that send input, persist records or stop a trial also name aneffect(target_input,cortex_stateortrial). The regression test fails on a tool without a label, or with the wrong one. Launch, restart, stop, attach and input stay bounded by the operator-owned launch profile, and a launch profile that attaches the runtime grants no write authority. - Debugger attach and detach are journaled. The
debug_*read tools stay available without write authority, because they do not write memory, but a debugger attached to a process suspends its threads. Each attach/detach is shown in the AI Activity tab and appended tocortex_debugger_events.jsonl. - Refused calls are logged to
cortex_denied_mutations.jsonl(tool, arguments, UTC time,runtimeorhost), besidecortex_core.dllandcortex.exe, so attempts can be counted. - Regression test.
tests/security_no_writes_regression.pystarts the test target, loads the runtime beforehand, then calls every tooltools/listreturns (251 on the--tools allprofile), with plausible arguments andmutation_permission=true, against a server started without--allow-writes, and requires the target's code and data hash to be unchanged. Controls prove the hash does change when writes are allowed, and that--allow-statesaves a note but still cannot write the target. It runs on x64 and x86 in CI. - Known limit, documented: the pipe token is a file readable by the same Windows user. A client that also has a shell or file access can read it and bypass these controls. An authority granted by the desktop for a limited time is planned.
- Left as is, on purpose:
cortex_operation_cancelandcortex_test_cancelneed no authority (they only cancel something already authorized), and thedebug_*read tools stay outside the control class: they write no memory, but a debugger attached to a process suspends its threads, which is why attach and detach are journaled.
Added
- Launching and testing programs. The operator lists the programs an agent may start in a launch profile file (
cortex.exe mcp --launch-config <file>); the agent selects a profile by name and cannot supply its own executable, arguments or working directory.cortex_launch_status,cortex_launch,cortex_restartandcortex_stopstart, restart and stop the program, with run limits, one running child per profile, and optional attach of the runtime. Seedocs/automated-tests.md. - Bounded input trials.
cortex_test_runposts allowlisted input to the launched program, reads values before and after, evaluates expectations (increased,unchanged, ...), waits on conditions, and writes JSON and Markdown reports under--test-results.cortex_test_get,cortex_test_listandcortex_test_cancelread and stop trials;cortex_test_comparecompares repeatable trials. Input never usesSendInput; only the allowlisted program receives window messages. - Persistent typed knowledge graph.
project_knowledge_put,project_knowledge_get,project_knowledge_list,project_knowledge_query,project_knowledge_verifyandproject_knowledge_graphkeep claims, revisions and verifications in the project;cortex_knowledge_graphandcortex_knowledge_code_checkread them and revalidate code references after a restart or a new generation of the program. - Evidence and code observations.
cortex_test_linklinks a recorded trial to a knowledge record;cortex_test_code_context,cortex_test_code_candidatesandcortex_test_code_linkresolve the module and symbol of code observed during a trial (x64 PE unwind ranges included) and retain the location with the binary hash.cortex_test_evidence_graphshows the evidence behind a claim. - Investigations. Predictions are evaluated against what a trial observed;
cortex_test_choosepicks a discriminating next experiment;cortex_test_step_prepare,cortex_test_step_continue,cortex_test_step_record,cortex_test_step_nextandcortex_test_step_getrun it as a supervised step that survives a reconnection;cortex_test_generateandcortex_test_generate_preparepropose bounded experiments (experimental).cortex_test_report,cortex_test_report_get,cortex_test_investigation_report,cortex_test_investigation_summary,cortex_test_catalog_listandcortex_test_catalog_savekeep the reports and a catalog of tested scenarios. cortex_agent_guidereturns the built-in guidance for an agent using these tools;AGENTS.md,agent/testing.mdandagent/investigation-template.mddocument the workflow.- 37 tools in total (31 host tools and the 6
project_knowledge_*primitives): the--tools allprofile now lists 251 tools and the compact profile 72.
Changed
- Semantic tool results no longer carry
confidence,evidence_confidence,candidates,alternative_hypothesesortested_hypotheses. Cortex never computed them (confidencewas a constant 1.0), and a figure that looks like a measure misleads the agent reading it.statusis now documented as what it is:plan_ready,completed,failed,cancelledortimed_out. - The documentation and README no longer say that the application enforces writes for every call where that was only true of the desktop.
Fixed
debug_registersfroze the target.ReadTargetThreadRegisterssuspended a thread, read its context, then closed the thread handle before the guard that resumes it ran;ResumeThreadon a closed handle fails, so the thread stayed suspended. Found by the new regression test; fixed by resuming explicitly before closing the handle.cortex_test_runwas listed asread_only.tools/listdescribed the tool that sends keys and mouse clicks to the launched program as read-only. It is nowhost_controlwitheffect: target_inputand requiresmutation_permission, like the other host tools that act. Only the label was wrong: the permission and the operator-owned launch profile were already enforced when the tool is called. The regression test now checks the label of five representative host tools.
Tests and CI
- The five Windows workflows
imgui-gui-tests,contracts,imgui-ui,unified-hostande2e-windowsrun on every pull request and on pushes tomain, with no path filter, so a change outside the usual paths cannot skip them. tests/fixtures/mcp_tool_risks.jsonfreezes the risk class of every one of the 179 primitive tools;tests/mcp_authority_tests.cppcovers classification, the three authority levels and the denial log.tests/test_runner_e2e.pyarms hardware-write log breakpoints, so its main client is started with--allow-writes; a first client with--allow-stateonly asserts that a launch-profile attach cannot arm one.publish-release.ymlpublishes when the commit message containsRelease v1.0.1, so a merge commit whose pull request is titled that way publishes as well as a direct commit.