Skip to main content

Seriously lightweight agent TUI for Nexus environments

Project description

Nexus-Nancy

Nexus-Nancy is a seriously lightweight, pip-installable terminal agent focused on OpenAI-style API compatibility and local tool execution.

Design goals

  • Minimal TUI and command surface
  • Single provider protocol: OpenAI-compatible /chat/completions
  • Primary tool: shell (bash) with sandbox defaults
  • Notebook-aware local tools for .ipynb read/edit workflows
  • Context controls: /new and /handoff
  • Plain-text session logs
  • Attachment shorthand: @path/to/file

Install

python -m venv .venv
source .venv/bin/activate
pip install -e .

Configure

On first run in any directory, Nexus-Nancy creates local files in .agents/:

  • .agents/nnancy.yaml
  • .agents/sandbox_allowlist.txt
  • .agents/instructions.txt
  • .agents/relay_instructions.txt
  • .agents/hand-off_instructions.txt

The prompt templates are bundled inside the installed package and copied into the working directory on first run. Nexus-Nancy does not invent ad hoc fallback prompt text at runtime.

API key resolution order:

  1. local key file from api_key_file (default .agents/secrets/openai.key)
  2. env var from api_key_env (default OPENAI_API_KEY)

For shared environments, using the local key file is recommended.

Before any provider call, Nexus-Nancy runs strict preflight validation: API key/base URL sanity, required message structure (system + user), tool spec integrity (including bash), and request-size guard via max_preflight_tokens. The live system prompt is read from .agents/instructions.txt and rendered at runtime, including a dynamically generated tools block.

Set user_display_name in .agents/nnancy.yaml to control the user label shown in the TUI transcript (default: USER).

Execution routing is controlled in .agents/nnancy.yaml:

  • execution_strategy: auto uses native OpenAI-style tool calls only after support is verified.
  • execution_strategy: universal always uses the compatibility text harness.
  • execution_strategy: native_openai requires verified native tool support and fails loudly otherwise.
  • native_tools, reasoning_channel, and parallel_tool_calls default to auto; set a boolean only when you want an explicit override.
  • capability_probe: true enables a cheap live probe that asks the provider to return a synthetic tool call without executing any local tool.

Edit these with:

nnancy config
nnancy instructions

For API key management during chat sessions:

  • /config opens .agents/nnancy.yaml
  • /key replaces the API key value (does not print current key)

Guides

Usage

nnancy
nnancy -t "summarize @README.md"
nnancy doctor
nnancy config
nnancy instructions

nnancy doctor checks workspace bootstrap files, sandbox root, API key source, key-file permissions, selected execution route, detected capability status, and base URL health via <base_url>/models.

sandbox_allowlist.txt supports one substring per line. If a substring appears in a command, substring-based sandbox blocks are bypassed for that command.

Interactive mode uses a Python Textual TUI when running in a real terminal. If TTY support is missing (for example some notebook terminal environments), it automatically falls back to a plain line-input mode.

The TUI status line shows model, mode (sandbox/yolo), current working directory, and approximate context token count. Each TUI session gets an id shown in that status line.

Transcripts are always saved for posterity at:

  • .agents/transcripts/<id>.txt

These transcripts and the logs/session-*.log files are plain local files. Anyone with access to the workspace can read them.

Use Ctrl+Y in TUI to show copy mode info with the current transcript path. Ctrl+Y suspends the TUI and opens the transcript in your terminal (less if available, else cat) so native terminal text selection/copy works, then returns to the app.

Default model is gpt-5.4-mini. Context token estimate uses tiktoken when available and falls back to a simple character heuristic otherwise.

Inside the prompt:

  • /new starts a fresh in-process context
  • /handoff writes a JSON continuation snapshot to logs/handoff.json
  • /handoff path/to/handoff.json loads prior context
  • /config opens workspace config file .agents/nnancy.yaml
  • /key NEW_API_KEY replaces API key file contents
  • @relative/path inlines file content into your prompt

Universal assistant protocol:

  • User-visible assistant text must be inside [RESPONSE]...[/RESPONSE]
  • Any other assistant text is treated as private raw/debug output
  • Each completed assistant turn must end with [EOT]
  • Tool calls must use JSON arguments that exactly match the surfaced tool schema

Native OpenAI route:

  • Native mode sends tools through the OpenAI-compatible tools payload.
  • Assistant text is shown directly and is not parsed for [RESPONSE] wrappers.
  • If a provider returns a valid JSON tool call in plain text instead of tool_calls, Nexus-Nancy treats it as a raw function call safety net.
  • Local models such as Gemma or Llama variants are most reliable when their backend supports native chat templates, for example llama.cpp with Jinja templating enabled.
  • Providers that claim OpenAI compatibility may still reject tools, ignore tools, or return malformed calls; leave execution_strategy: auto unless native support is known or verified.

In the Textual TUI, you can also run /key with no argument to set the key via hidden prompts (value + confirmation) without echoing the key to screen.

Notes

  • Tool execution is local.
  • Sandbox mode is default.
  • Chat logs are written to logs/session-*.log.
  • In the TUI, only [RESPONSE] blocks are shown as assistant replies; non-response assistant text and tool output are shown as collapsed raw/debug blocks.
  • Tool calls outside the allowlist prompt for yes, no, or respond approval in sandbox mode.
  • nnancy yolo exists but is intentionally not advertised in help output.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexus_nancy-1.1.0.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexus_nancy-1.1.0-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

Details for the file nexus_nancy-1.1.0.tar.gz.

File metadata

  • Download URL: nexus_nancy-1.1.0.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nexus_nancy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8c450af9281f6514285549edba38f80158980c807bd9a4c86cd23f6866d26d60
MD5 62ec69c4e4212cf32b665cdd0125736f
BLAKE2b-256 0d46387bea32a6b1f625dfcb43a2442aa39eb25da7d4b2cfcaf4d9b76706621f

See more details on using hashes here.

File details

Details for the file nexus_nancy-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: nexus_nancy-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nexus_nancy-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40a5b03c94b56258517f9b2150e43d50773833740d510439792e81b7ed2afc1b
MD5 adfaee8042f9343908c7505eb280dc8b
BLAKE2b-256 9e22365a7c53b9f633e6add83444fdafc2c3b7f91d712f7cb7d6e67e272dd1e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page