How leighklotz/answer works
Project purpose
Answer is a Bash-based Linux/macOS code-assistant toolchain. It treats LLM requests and responses as Unix pipeline data, supporting interactive terminal use, machine-readable conversation streams, multi-turn chaining, context ingestion, and controlled code extraction.
Core components
• Conversation entry and response rendering — bin/ask
Public ask, help, and answer commands construct prompts, accept standard input, preserve conversation history in pipeline mode, and render the final assistant response. Interactive use is documented as producing plain text, while piped use emits structured JSON intended for downstream commands.
• Context and command adapters — bin/lx
lx ingests one or more files as markdown-formatted context. bx captures shell-command output for inclusion in an LLM request. These adapters let external shell commands and files become prompt inputs without taking ownership of the caller’s workspace.
• Execution and extraction boundary — bin/unfence
unfence extracts targeted code blocks from model output and provides a review/confirmation step before output is passed to an interpreter such as Bash or Python. The interpreter is application- or user-supplied, not part of this repository.
• Workspace, session, and model management — bin/commands/hx.sh
The hx management interface enables or disables shell integration, configures model settings, controls cache behavior, and exposes recent interaction information. bin/commands/hx-bootstrap.sh supports installing the shell integration into a Bash session.
• Caching and provenance — bin/commands/cache.sh
The documented runtime state includes JSON inference cache entries under a discovered project .hallux workspace, with a fallback under ~/.config/hallux/.cache/. Cache commands manage retention and session caching. Provenance commands under bin/commands/provenance.sh record selected interactions as Git notes under provenance/hallux; this is separate from inference caching and Bash history.
• Shared shell and optional integrations — bin/functions.sh
Common shell behavior is organized in shared functions and command scripts. bin/tools provides an optional bridge to the external toolex project for native LLM tool calls; it is not the primary request path.
External interfaces
The main interfaces are Bash commands, standard input/output/error, environment variables, local filesystem state, and a configured LLM API or self-hosted endpoint. Users may pipe results into ordinary Unix utilities or into external interpreters. Git is an external owner of provenance notes, and Bash owns the underlying command history files.
Relationships
A user or shell command supplies prompts, files, or command output to ask/help, optionally through lx or bx. Those commands create conversation data for the configured LLM path; answer terminates a structured pipeline by producing plain text. A downstream ask or help can consume the structured history and append another turn. unfence forms a separate safety boundary between generated text and user-selected interpreters. hx manages the session, workspace discovery, model settings, cache controls, and provenance operations around these command-line interactions.
Components 13
Command interfaces
Bash commands for prompts, context, and code extraction.
- ask / help / answer · Builds prompts, preserves pipeline history, and renders responses.
bin/ask - lx / bx · Turns files and shell output into prompt context.
bin/lx - unfence · Reviews selected generated code before execution.
bin/unfence - toolex bridge · Optional bridge for native LLM tool calls.
bin/tools
Session and state
Workspace, cache, and provenance management.
- hx management · Controls shell integration, models, cache behavior, and interaction information.
bin/commands/hx.sh - Project .hallux workspace · Discovered workspace for JSON inference cache entries.
- Inference cache · Manages retention and session caching, with a user fallback cache.
bin/commands/cache.sh - Provenance · Records selected interactions as Git notes.
bin/commands/provenance.sh
Other components
- User / shell command
- Bash / Python interpreter
- Configured LLM endpoint
- Git
- toolex
Connections 15
- User / shell command → ask / help / answer: supplies prompts
- User / shell command → lx / bx: supplies files/output
- lx / bx → ask / help / answer: provides context
- ask / help / answer → Configured LLM endpoint: sends requests
- Configured LLM endpoint → ask / help / answer: returns responses
- ask / help / answer → User / shell command: emits conversation data
- User / shell command → unfence: selects generated code
- unfence → Bash / Python interpreter: passes reviewed code
- hx management → Project .hallux workspace: discovers workspace
- hx management → Inference cache: controls caching
- Inference cache → Project .hallux workspace: stores cache entries
- hx management → Provenance: exposes operations
- Provenance → Git: records notes
- ask / help / answer → toolex bridge: optionally bridges tools
- toolex bridge → toolex: calls tool system