Skip to content

feat: add Agent OS Shell for issue #750 - #925

Merged
AmitoVrito merged 5 commits into
SynapseKit:mainfrom
DhruvGarg111:feat/issue-750-agent-os-shell
Aug 12, 2026
Merged

AmitoVrito merged 5 commits into
SynapseKit:mainfrom
DhruvGarg111:feat/issue-750-agent-os-shell

Conversation

@DhruvGarg111

Copy link
Copy Markdown
Collaborator

Summary

Implements the Agent OS Shell described in #750: a local-first hybrid shell that accepts ordinary shell syntax and quoted natural-language requests in the same input line.

Closes #750

What changed

  • Added synapsekit.shell contracts, mixed-input lexer, direct argv executor, conditional operators, bounded output, timeouts, and subprocess cleanup.
  • Added deterministic offline planning plus injectable strict-JSON LLMShellPlanner support for local-first BaseLLM/EdgeRuntime integrations.
  • Added KnowledgeMesh, optional Ambient Agent status, bounded Git context, redacted SQLite history, translation caching, and mesh-enriched completion.
  • Added bash, zsh, fish, and PowerShell init/completion plugins.
  • Added fail-closed destructive-operation previews. Destructive commands require confirmation and an Ed25519 signing key; signed preflight and final audit bundles include post-command Git diff metadata.
  • Added synapsekit shell, standalone synshell, key generation, history, status, completion, init, JSON, dry-run, and audit options.
  • Added documentation, executable example, and focused acceptance tests.

Verification

  • 16 passed in tests/shell
  • async-blocking gate clean (515 files scanned)
  • Ruff check clean
  • Ruff format check clean
  • targeted mypy clean (13 source files)
  • compileall and git diff --check clean

The branch contains three logical commits and no co-author trailers.

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Reviewed — the security posture (argv-only, fail-closed destructive gate, signed receipts) is strong. I pushed fixes for two bugs that trigger on everyday input directly to the branch:

Fixed (blocking):

Both ship with regression tests (bounded output + non-hanging pipeline; cue-word quoted args staying shell tokens).

Non-blocking follow-ups:

  • Destructive detection keys on argv[0], so sudo rm -rf …, xargs rm, dd of=/dev/sda skip the signing gate — worth hardening.
  • Redirection/globbing/expansion (>, *, $VAR) are passed as literal tokens under argv-only execution — the docs page should call this out explicitly.
  • No EventBus/Live wiring yet — shell plans/executions should publish to the bus.

Two correctness fixes in the Agent OS Shell:

- DirectShellExecutor used Process.communicate(), which buffers the child's
  entire stdout/stderr into memory before max_output_bytes is applied, so an
  unbounded producer (cat /dev/zero, yes) could exhaust RAM, and a pipeline
  (yes | head -1) would hang because the producer never receives SIGPIPE.
  Replace it with a streaming _drain() that reads under a hard byte cap and
  kills the child at the cap; a capped producer still feeds the next stage.
- The lexer's _looks_like_natural_language treated any quoted span beginning
  with a cue word (find/run/search/...) as natural language regardless of
  position, so `git commit -m "find and fix the bug"` and
  `grep "search term" file` silently dropped the quoted argument. Gate the
  cue-word and bare-phrase heuristics on the quote opening a command; keep
  only the explicit nl:/ask: sentinels unconditional.

Adds regression tests for both (bounded output + non-hanging pipeline;
cue-word quoted args staying shell tokens).

Fixes SynapseKit#929
Fixes SynapseKit#930

Co-authored-by: Dhruv Garg <[email protected]>
@AmitoVrito
AmitoVrito force-pushed the feat/issue-750-agent-os-shell branch from fbc5503 to 3df9ac9 Compare August 12, 2026 20:18
The Agent OS Shell (SynapseKit#750) published nothing to the Live EventBus, so shell
plans and executions were invisible in the glass-box dashboard. Auto-instrument
ShellSession the same way every other subsystem is wired: plan and run publish
shell.plan / shell.run events (with the input). Async contract preserved; no-op
when Live is off. Adds a no-mock test running a real ShellSession over a real
subprocess. Records the feature and both shell bug fixes in the changelog.

Co-authored-by: Dhruv Garg <[email protected]>
@AmitoVrito

Copy link
Copy Markdown
Collaborator

Follow-up: wired the Agent OS Shell into SynapseKit Live (commit a3cec05) — plan and run now publish shell.plan / shell.run events. Added a no-mock test and a CHANGELOG entry (feature + both bug fixes). Clears the EventBus follow-up from my review above.

AmitoVrito added a commit that referenced this pull request Aug 12, 2026
…ive-shell

Integrate #923 + #924 + #925: embeddings layer, Hive Mode, Agent OS Shell
@AmitoVrito
AmitoVrito merged commit 49985df into SynapseKit:main Aug 12, 2026
14 checks passed
@AmitoVrito

Copy link
Copy Markdown
Collaborator

Merged into main via the batch integration PR #932. Thanks @DhruvGarg111! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2.1 (beyond): Agent OS Shell — natural language layer over bash/zsh/PowerShell with context awareness

2 participants