Last Signal v0.1.0•Ghost in the Machine

Digital afterlife forensics for failed AI agents.

When autonomous agents enter unproductive retry loops, repeatedly fail at tool execution, or terminate unexpectedly, conventional monitoring often leaves you with logs but no clear explanation.

Last Signal reconstructs execution traces, detects failure patterns using deterministic rules, and generates evidence-grounded digital autopsies, entirely offline.

$pip install last-signal
PyPI Package (v0.1.0)•Python >= 3.10•MIT License•Zero Cloud Telemetry
Process Supervisor // PID 84219
LIVE AUDIT
$lastsignal run -- python agent.py
[supervisor] subprocess.Popen(shell=False) initialized
trace: .lastsignal/traces/ls_9f8e210a.jsonl100% OFFLINE
22:45:01 [AGENT] Action: sync_embeddings -> vector_sync
22:45:04 [WARN] Socket timeout from 10.0.4.12:19530
22:45:05 [ERROR] ConnectionRefused: [Errno 111] Target cluster offline
22:45:07 [RETRY 1/3] vector_sync (backoff: 1000ms) -> ECONNREFUSED
22:45:15 [CRASH] Process exited with status code: 1
DETERMINISTIC VERDICTΔt = 38ms
RULE-REPEATED-TOOL-FAILURECRITICAL
RULE-UNPRODUCTIVE-RETRY-LOOPCRITICAL
RULE-TERMINAL-TOOL-FAILUREHIGH

llama3.2 (offline): Upstream cluster outage; agent lacked circuit-breaker or local Chroma fallback.

reports/postmortem_ls_9f8e210a.mdTry Quickstart
Forensic Workbench // Live Investigation Instrument

Investigate dying agent traces with deterministic precision.

Step through the full execution stream, audit verified state-machine rules, and inspect the generated incident autopsy.

Lifecycle:
$lastsignal run -- python agent.py
[lastsignal] Supervisor attached: PID 84219 | Subprocess execution: shell=False
[lastsignal] Unbuffered pipe stream active -> .lastsignal/traces/ls_9f8e210a.jsonl
22:45:01.102 [TRACE] event_type=agent_start trace_id=ls_9f8e210a session_active=True
22:45:01.350 [AGENT] Bootstrap successful. Initialized memory context & tool registry.
22:45:02.004 [AGENT] Target objective: Synchronize document vectors with external cluster
22:45:02.012 [TOOL] vector_sync invoked with target_shard='milvus-primary-prod'
22:45:04.119 [WARN] Socket handshake awaiting ACK from host 10.0.4.12:19530 (timeout=2000ms)
22:45:05.150 [ERROR] ConnectionRefusedError: [Errno 111] Cluster node refused TCP connection
22:45:05.152 [TRACE] event_type=tool_result operation=vector_sync status=failed error='ConnectionRefused'
22:45:05.300 [AGENT] Caught tool failure. Evaluating recovery policy: retry_immediate
22:45:06.100 [RETRY] Attempt 1/3 for tool vector_sync (backoff: 1000ms)
22:45:07.104 [ERROR] vector_sync failed: ECONNREFUSED 10.0.4.12:19530
22:45:08.200 [RETRY] Attempt 2/3 for tool vector_sync (backoff: 2000ms)
22:45:10.208 [ERROR] vector_sync failed: ECONNREFUSED 10.0.4.12:19530
22:45:11.300 [RETRY] Attempt 3/3 for tool vector_sync (backoff: 4000ms)
22:45:15.312 [ERROR] vector_sync failed: max_retries_exhausted (3 consecutive errors)
22:45:15.315 [AGENT] Unhandled exception in tool pipeline: VectorClusterUnavailableError
Traceback (most recent call last):
File "/workspace/agent.py", line 84, in execute_pipeline
sync_embeddings(shard=target_shard)
File "/workspace/tools/vector.py", line 42, in sync_embeddings
raise VectorClusterUnavailableError('Milvus primary offline after 3 attempts')
VectorClusterUnavailableError: Milvus primary offline after 3 attempts
[lastsignal] Supervised child process terminated with exit code: 1
[lastsignal] Reconstructing trace ls_9f8e210a (18 events ingested)...
[FINDING] MATCH: RULE-REPEATED-TOOL-FAILURE (Severity: CRITICAL)
-> Tool 'vector_sync' failed 3 distinct times across lines 14, 22, 31
[FINDING] MATCH: RULE-UNPRODUCTIVE-RETRY-LOOP (Severity: CRITICAL)
-> 3 sequential retries without intervening success before process exit
[FINDING] MATCH: RULE-TERMINAL-TOOL-FAILURE (Severity: HIGH)
-> Tool failure immediately preceded fatal process crash (delta: 38ms)
[OLLAMA] Local model llama3.2 queried @ http://localhost:11434 (100% offline)...
[AI HYPOTHESIS] The agent suffered an unhandled upstream cluster outage. Lacks a circuit
breaker and local Chroma fallback index. Exponential jitter recommended.
[SUCCESS] GitHub-ready forensic autopsy generated: reports/postmortem_ls_9f8e210a.md
[SUCCESS] Verified ground-truth locked. Zero external network telemetry sent.
SUPERVISOR: OFFLINE LOCKEXIT: 1 (ABNORMAL)
3 CRITICAL FINDINGS•ZERO CLOUD CALLS
Architectural Invariants

Designed for deterministic proof, not probabilistic guessing.

Traditional monitoring relies on bloated cloud dashboards and fuzzy LLM prompts. Last Signal provides an offline-first forensic engine built on four immutable pillars.

State Machine Invariants

Deterministic Ground Truth

Verified state-machine rules identify failure patterns without treating LLM guesses as facts. Rules audit exact tool failure counts, temporal crash deltas, and retry loops directly from raw JSONL traces.

Zero probabilistic hallucinations deciding whether an agent failed.
Air-Gapped & Zero Telemetry

Offline-First Execution

The forensic core operates locally without requiring external cloud AI services. Proprietary agent prompts, tool parameters, and internal memory vectors never leave your host workstation or VPC.

100% offline-compatible; safe for regulated and sensitive enterprise environments.
Grounded Ollama Synthesis

Local AI Diagnosis

Optional Ollama-powered interpretation provides contextual explanations and recovery suggestions using local open-weight models (default: llama3.2). AI reasoning is strictly bounded by deterministic evidence.

Strict epistemic boundary: AI hypotheses cannot override verified failure facts.
Structured Incident Post-Mortems

GitHub-Ready Autopsies

Generate structured Markdown post-mortems containing chronological evidence, verified finding tables, and remediation checklists. Formatted specifically for pull requests and incident retrospectives.

Exported directly to reports/postmortem_*.md for instant developer review.
CLI Workflow

Three commands from execution crash to autopsy.

Non-invasive process supervision that works with any Python script or agent framework without requiring SDK code refactors.

01Supervise Subprocess
$lastsignal run -- python agent.py

Launches the agent as a supervised child process using subprocess.Popen(shell=False). Background worker threads stream unbuffered stdout and stderr, capturing JSONL events and fatal tracebacks without modifying agent code.

02Deterministic Trace Audit
$lastsignal analyze

Auto-selects the latest failed trace from .lastsignal/traces/ and evaluates it against all 4 state-machine failure rules. Validates failure frequencies, retry loops, and temporal proximity to abnormal termination.

03Generate Markdown Autopsy
$lastsignal report

Synthesizes deterministic findings, chronological event logs, and optional local Ollama root-cause hypotheses into a publication-ready Markdown post-mortem document directly in reports/.

RULE-REPEATED-TOOL-FAILURE•Failures >= 2

At least two distinct operational failures associated with a single tool in one execution session.

[CRITICAL]Spec
RULE-UNPRODUCTIVE-RETRY-LOOP•Consecutive retries >= 2

Sequential retries executed without an intervening successful operation before process exit.

[CRITICAL]Spec
RULE-TERMINAL-TOOL-FAILURE•Temporal delta < 500ms

A tool failure occurs as the immediate precursor event prior to abnormal process termination.

[HIGH]Spec
RULE-UNRECOVERED-EXECUTION-FAILURE•Exit code != 0

Unhandled fatal execution failure without a recorded cleanup or recovery checkpoint.

[CRITICAL]Spec
LOOKING FOR CONTRIBUTORS // TYPESCRIPT MODULE

Help build the TypeScript module.

Last Signal is open source. The Python CLI establishes the forensic foundation; now we are actively inviting TypeScript and JavaScript developers to help design and implement the native TypeScript agent supervisor for Node.js, Bun, and Deno environments.