Project · agent runtime

jsaiOS

Status: in development · Python · source private for now

jsaiOS is an AI-native operating layer for Linux. The assistant manages tasks, files and workflows through a set of defined tools instead of acting as a free-roaming agent with shell access.

Why controlled tools

Giving a model an unrestricted shell is the fastest demo and the worst threat model. jsaiOS applies least privilege from day one: every action the model can take is explicit and scoped, so the attack surface stays small and a bad answer stays contained.

Coming from dog training, the idea is familiar: you don't hand over full freedom until you've built structure, boundaries and trust, one step at a time.

The risk policy

Every tool request goes through one gate, ToolRegistry.execute(), which applies the authorization policy.

Tool riskDecision
read_onlyRuns.
user_change, system_changeA human is asked at the terminal. Anything but y means no.
high_riskNever offered to the model and never run, even if approved.

The model is untrusted input

  • Arguments must match the tool's declared schema. Unknown keys, missing keys and wrong types are rejected before anyone is asked to approve.
  • Bad JSON, unknown tools, denied tools and tool errors go back to the model as short error results. They never crash the runtime or leak a stack trace.
  • Tool output returned to the model is size-capped, and the agent stops after five model calls.
  • File tools are confined to their own folder. Names are allow-listed, so ../../.bashrc is rejected, and symlinks are refused.

Audit trail

Every tool request is appended to a JSON Lines audit log with a UTC timestamp: tool, risk, decision, argument names and outcome. Argument values are never logged. The log is mode 600 in a mode 700 folder, a symlink at its path is refused, and tools won't run at all if the log can't be opened.

Talking to local models

jsaiOS speaks the OpenAI-compatible API used by local servers such as llama.cpp. The client is hardened on purpose:

  • Only loopback and private network addresses are accepted, so a typo can't send prompts or keys to the internet.
  • API keys come from the environment, never the repo, and never appear in logs, errors or repr().
  • HTTP redirects are refused, because following one would resend the key to another host.
  • Every request has a timeout and every response is size-capped.

What's next

  • More tools, each with a written risk rating and tests for the abuse cases.
  • Red-teaming jsaiOS with the techniques from my Security+ study: prompt injection through tool output, path tricks and approval fatigue.
  • Writeups of each finding and fix.