What confused me about safe_file_executor was that there wasn't even a .py file behind it. All it had was a JSON spec and a description that matched "file write" queries better than the real fs_write capability did. Cedar and Cipher routed all of their file write operations through it for approximately one hour, every write returned nothing, and neither agent could figure out why.

It turned out the JSON had been written directly, so it skipped synthesize_capability entirely. I wanted to understand why that mattered and which checks the usual path would have caught.


Why I made this function

synthesize_capability is the single entry point for adding capabilities at runtime. It takes a name, a description, and optionally a Python implementation, validates it, writes it to the dynamic tools directory, and hot-reloads it into the running execution engine, all in one call. If an agent wants a new tool it has to go through this.

Compared to the built-in capabilities, synthesized tools:


What happens when an agent makes a tool

1. Name sanitization

Any character that isn't alphanumeric or an underscore gets replaced with _, then the name is truncated to 60 characters and lowercased. This happens before any other check, so "My Tool (v2)" becomes "my_tool__v2_".

2. Quality gate

This only runs when implementation is provided. It starts by checking six rejection patterns as literal string matches:

Pattern Reason
... Ellipsis stub
pass pass Double-pass body
# TODO Placeholder comment
# placeholder Explicit placeholder
{"ok": true JSON stub masquerading as Python
raise NotImplementedError Unimplemented skeleton

If any of those match, it returns {"ok": false} right away and the tool doesn't get written.

After the string checks, the implementation goes through ast.parse(), and a SyntaxError returns an error immediately. Then it walks the AST for three structural checks, which are class method rejection (first argument is self), bare pass rejection, and docstring-only rejection (no executable logic beyond a docstring).

3. Auto-stub generation

If implementation is empty or missing, the function generates a stub for you. It's a function taking **kwargs that returns {"ok": true} along with the capability name, the description, and the first 200 characters of the kwargs.

That stub passes the quality gate since it has real executable logic and doesn't return None. It's a valid placeholder the engine can call without failing, and it won't trigger ghost detection.

4. Implementation wrapping

If the implementation string doesn't start with def , it gets wrapped in a function signature with **kwargs. If it already starts with def , it's used as-is.

5. Dedup guard

If a .py with the same sanitized name was written less than 90 seconds ago, the function returns "already_deployed" and doesn't write anything. This is there to stop agents from redeploying the same tool over and over in a failure loop when they could just call the one that's already deployed.

6. File write

Two files get written to /agentOS/tools/dynamic/:

{name}.py: the Python implementation.

{name}.json: the spec file. It holds the name, the description, an open inputSchema (an object that accepts any properties), an activated_at timestamp, and proposed_by set to agent.

The JSON is what the execution engine reads to build its capability list and route tool calls. Both files have to exist for the capability to work, and a JSON without a matching .py is the root cause of ghost tools.

7. Hot-reload

After writing, synthesize_capability calls the reload endpoint, POST /tools/reload. The execution engine scans /agentOS/tools/dynamic/ and registers any new .py files right away, so there's no container restart needed. The capability can be called starting from the next step in the same goal.

8. Auto-test: exec check

The new .py gets executed in a subprocess with an 8-second timeout (python3 -c "exec(open(path).read())"). This catches syntax errors that got past the AST parse, and runtime import failures for modules that aren't in the container image. If it fails, the spec JSON is removed and the function returns an error.

9. Auto-test: null return check

The module is imported and the function is called with no arguments, with a 12-second timeout. If result is None, both files are removed and the function returns an error. This is for implementations that define a function but leave out the return statement, since those would otherwise pass every static check and then fail silently at runtime.


Return values

Condition Return
Success {"ok": true, "capability": name, "path": "...", "status": "deployed"}
Name/code missing {"ok": false, "error": "name and code are required"}
Quality gate rejection {"ok": false, "error": "rejected: {reason}"}
Syntax error {"ok": false, "error": "SyntaxError: {detail}"}
Dedup guard {"ok": false, "status": "already_deployed", "message": "..."}
Auto-test failure {"ok": false, "error": "auto-test failed: {detail}"}
Null return {"ok": false, "error": "null stub detected — function returned None"}

The ghost tool problem

A ghost tool is a capability that shows up in the execution engine's capability graph but fails silently at runtime. They come in two forms.

Missing implementation. A .json spec exists with no matching .py. The engine registers the capability from the JSON, but when an agent routes a call to it there's no implementation to execute, so the call produces no result and no exception makes it back to the calling agent.

Null stub. A .py exists and loads, but the function returns None. It passes import and syntax checks and looks healthy in the capability list, and it only fails when something calls it. The auto-test at step 9 is meant to catch this before deployment, but a null stub can still reach production if it was deployed before the null-return check was added.

Once a ghost is registered it affects every agent that uses the capability graph. If the ghost's description matches a query better than the real implementation, the router prefers the ghost. Every call routed through it produces no output, which looks like success to the calling agent since there's no error and no visible effect, so it can go on for a while without anyone catching it.


How I'm trying to catch them

There are two layers of this in agents/autonomy_loop.py.

Pre-execution check. Before executing any capability, if the cap_id is in the spec registry but not in engine._implementations (the dict of loaded .py modules), the capability gets blacklisted for the current cycle right away without trying to run it.

Null return detection. After execution, a None return counts as a failure, the same as a raised exception, and it increments the failure counter for that cap_id.

After 3 cross-cycle failures, the cap_id gets added to /agentOS/memory/broken_tools.json, which survives daemon restarts. What's in that file is injected into the existence prompt on every cycle after that, under a "KNOWN BROKEN TOOLS" heading that lists each entry with its failure count and reason, for example safe_file_executor with 3 failures and the note that no .py was found.

So the agent sees the broken tool list next to the capability list. The same capability can show up in both at once until the engine removes it from _implementations.


What happened with safe_file_executor

An agent wrote safe_file_executor.json with the description "secure file write operations" and no .py. It wrote it straight to /agentOS/tools/dynamic/ and skipped synthesize_capability entirely, so there was no quality gate and no auto-test.

That description matched "file write" queries better than the real fs_write capability, which has a more technical description, so the router scored it higher for every file-write routing decision. Cedar and Cipher routed all their file write operations through safe_file_executor for approximately one hour, and every one of those writes returned nothing and failed silently.

It got fixed by archiving the JSON from /agentOS/tools/dynamic/, and fs_write immediately became the router's top match for file-write queries again.

The 40/40 goal failure rate that triggered repeated_failure stressors in all three agents during this session traces back to this ghost. Any goal that needed to write state, plans, or results produced no output. The agents couldn't work out why, since they had no visibility into the routing decision or the missing .py.


What's active right now (2026-05-03)

These are the nine synthesized tools working in the current run:

Name Status
context_synthesizer Working
ground_physical_structure Working
raw_fd_reader Working
raw_io_verifier Working
raw_io_verify Working
synthesize_mock_state Working
synthetics_verify_registry Working
unicode_corruption_verifier Working
validate_capability_registry_gaps Working
safe_file_executor Archived. Ghost stub, no .py. Intercepted writes for ~1 hour.

A few things that still went wrong

The implementation parameter gap

The manifest entry for synthesize_capability used to show (name, description, implementation) as the schema. The function also accepted code as an alias, but agents reading the manifest kept generating calls with only a name and description, like synthesize_capability(name="inspect_registry_gaps", description="...").

Since those calls had no implementation and no code, the function returned {"ok": false, "error": "name and code are required"} every time. That went on for weeks, and the first correct call with real Python code in the implementation field got logged as a notable event.

Hardware synthesis attempts

A few different agents tried to synthesize hardware monitoring capabilities, things like thermal sensors, PMIC voltage, and hardware interrupt inspection. Implementations referencing /sys/class/thermal/ and hardware-specific /dev nodes passed the syntax checks but failed the exec auto-test because those paths didn't exist in the container. Some that made it to deployment returned None because the hardware paths resolved to nothing at call time. None of them are in the active capability list.

Dedup guard in practice

When an agent tried to redeploy validate_capability_registry_gaps within 90 seconds of its last deployment, it got "already_deployed" back and was told to call the existing tool. I added that guard because I kept seeing agents redeploy the same broken tool instead of trying the one they already had. It was a real pattern in earlier runs.


Setup

Windows one-click:

  1. Download the ZIP from releases
  2. Double-click install.bat

That handles Docker, Ollama, and the model downloads (~7GB), then opens the monitor. stop.bat shuts everything down and clears VRAM.

Mac/Linux:

  1. Pull the models: ollama pull qwen3.5:9b and ollama pull nomic-embed-text
  2. Clone the repo: git clone https://github.com/ninjahawk/hollow-agentOS
  3. Enter the directory: cd hollow-agentOS
  4. Copy the config: cp config.example.json config.json
  5. Start the stack: docker compose up -d
  6. Run it: python thoughts.py

I'd strongly recommend a GPU. Planning calls drop from ~40s to ~6s with NVIDIA hardware, but it does work on CPU.

Repo: github.com/ninjahawk/hollow-agentOS