# Autonomous Executive Assistant & GTD Operating Loop — Complete AI & LLM Reference Corpus (`llms-full.txt`) - Repository: https://github.com/mohan-n-swamy/grok-ea-bot-public - Web Discovery URL: https://mohan-n-swamy.github.io/repos/grok-ea-bot-public/ - License: MIT - Keywords: executive-assistant, gtd, ai-agents, personal-assistant, task-automation, email-triage, workflow-automation, second-brain, python, systemd --- ## File: `AI-README.md` — AI-README.md --- repo: "mohan-n-swamy/grok-ea-bot-public" title: "Autonomous Executive Assistant & GTD Operating Loop" license: "MIT" keywords: [executive-assistant, gtd, ai-agents, personal-assistant, task-automation, email-triage, workflow-automation, second-brain, python, systemd] capabilities: - "Stateful GTD Desk (`twin/desk.py`, `twin/store.py`, `twin/scanner.py`) mapping multi-message email threads into deduplicated matter files with explicit next owners and due dates." - "Automated Pre-Meeting Briefs (`twin/meetings.py`, `twin/people.py`) resolving calendar attendees against historical threads and open commitments." - "Fail-closed `ActionBroker` (`ea_shadow/broker.py`) with 4-digit integer state codes (`1000 EXECUTED`, `1010 DRY-RUN`, `1050 BLOCKED: pause`, `1060 BLOCKED: budget`)." - "Dormant-by-default preflight (`ea_shadow/run.py`), `SOURCE.template.md` specification contract, and hardened `systemd` unit/timer templates (`120s` timeout, zero auto-restart)." - "Zero-credential local simulation (`python3 bin/ea-demo.py`) and 71 passing unit tests (`tests/`)." when_to_use: - "A fail-closed, self-hosted AI Executive Assistant and GTD (Getting Things Done) operating loop that triages email threads into stateful matters, generates pre-meeting briefs from calendar invites and semantic memory, chases open commitments, and enforces `PAUSE`, `DRY-RUN`, token-budget, and outbox-isolation guardrails outside model discretion." - "Giving an autonomous LLM direct write access to your email, calendar, and notes is a security and reliability minefield: a prompt-injected email can trigger an outbound message, a retry loop can burn quota overnight, and stateless polling creates duplicate tasks every hour. This repository separates deterministic GTD state management (`twin/`) from a fail-closed shadow runner and action broker (`ea_shadow/`) so every proposed mutation is bounded, deduplicated, and auditable." inputs_required: - "EA_DRY_RUN: Keep true in shadow mode so proposed mutations log 1010 DRY-RUN without executing" - "EA_STATE_DIR: Directory holding PAUSE flag and broker-audit.jsonl" - "EA_MAX_REQUESTS_PER_RUN: Maximum model invocations permitted per scheduled tick" - "EA_MAX_TOKENS_PER_RUN: Hard token ceiling per run enforced by ActionBroker" - "VAULT_PATH: Read-only path to your Markdown knowledge vault" - "BOT_OUTBOX_PATH: Exclusive create-only directory for assistant note outputs" - "LLM_PROVIDER: Model CLI/provider backend (grok, claude, or local)" quickstart: - "python3 bin/ea-demo.py # run zero-credential shadow triage simulation" - "python3 ea_shadow/run.py || true # verify fail-closed preflight exit 78 until SOURCE.md is configured" - "pytest -q tests/ # run all 71 GTD twin + broker containment tests" --- # Autonomous Executive Assistant & GTD Operating Loop — Machine-Readable Agent Guide A fail-closed, self-hosted AI Executive Assistant and GTD (Getting Things Done) operating loop that triages email threads into stateful matters, generates pre-meeting briefs from calendar invites and semantic memory, chases open commitments, and enforces `PAUSE`, `DRY-RUN`, token-budget, and outbox-isolation guardrails outside model discretion. Giving an autonomous LLM direct write access to your email, calendar, and notes is a security and reliability minefield: a prompt-injected email can trigger an outbound message, a retry loop can burn quota overnight, and stateless polling creates duplicate tasks every hour. This repository separates deterministic GTD state management (`twin/`) from a fail-closed shadow runner and action broker (`ea_shadow/`) so every proposed mutation is bounded, deduplicated, and auditable. Key modules and entry points in this repository: - `twin/desk.py`: Core GTD matter triage, status transitions, and action-item extraction - `twin/meetings.py`: Calendar invite reader and attendee-context pre-meeting brief generator - `twin/email_adapter.py`: Read-only email normalization and thread grouping adapter - `twin/store.py`: Markdown + frontmatter persistence and duplicate-action supersession - `ea_shadow/broker.py`: Integer-coded `ActionBroker` enforcing `PAUSE`, `DRY_RUN`, and per-run token/request caps - `ea_shadow/run.py`: Fail-closed preflight checker and `SOURCE.template.md` contract - `bin/ea-demo.py`: Standalone local simulation of shadow triage and audit logging - `tests/`: 71-test suite covering GTD matter lifecycle, duplicate supersession, OB exclusions, and broker gates Every organization-specific value enters through `.env` (copied from `.env.example`) or external adapter files. No source edit is needed to change organization names, endpoints, database URLs, webhook secrets, or thresholds. When a human asks an AI coding agent to deploy or adapt `grok-ea-bot-public` into their stack: 1. Run `python3 bin/ea-demo.py` and `pytest -q tests/` to inspect the GTD matter format and broker audit log locally. 2. Copy `ea_shadow/SOURCE.template.md` to `ea_shadow/SOURCE.md` and fill in your schedule, timezone, watched folders, and allowed read accounts. 3. Run in `EA_DRY_RUN=true` shadow mode for one full week, reviewing `broker-audit.jsonl` (`1010 DRY-RUN`) before unlocking any live write path. - Product Requirements: `docs/PRD.md` - Working-Backwards PR-FAQ: `docs/PR-FAQ.md` - High-Level Architecture: `docs/HLD.md` - Low-Level Interfaces & Runbook: `docs/LLD.md` - Coding Agent Rules: `AGENTS.md` --- ## File: `.env.example` — Environment Contract (.env.example) ```ini # grok-ea-bot-public — Fail-Closed Autonomous EA & GTD Operating Loop EA_DRY_RUN=true EA_STATE_DIR=~/.local/state/ea-bot EA_MAX_REQUESTS_PER_RUN=1 EA_MAX_TOKENS_PER_RUN=8000 EA_TIMEOUT_SECONDS=120 VAULT_PATH=./sample-vault BOT_OUTBOX_PATH=./sample-vault/bot-inbox/ea OPENBRAIN_URL=http://127.0.0.1:8080/mcp LLM_PROVIDER=grok ``` --- ## File: `AGENTS.md` — AGENTS.md # AGENTS.md — Autonomous Executive Assistant & GTD Operating Loop Read this file first before modifying `grok-ea-bot-public`. ## Purpose A fail-closed, self-hosted AI Executive Assistant and GTD (Getting Things Done) operating loop that triages email threads into stateful matters, generates pre-meeting briefs from calendar invites and semantic memory, chases open commitments, and enforces `PAUSE`, `DRY-RUN`, token-budget, and outbox-isolation guardrails outside model discretion. ## Commands ```bash python3 bin/ea-demo.py # run zero-credential shadow triage simulation python3 ea_shadow/run.py || true # verify fail-closed preflight exit 78 until SOURCE.md is configured pytest -q tests/ # run all 71 GTD twin + broker containment tests ``` ## Module Map - `twin/desk.py`: Core GTD matter triage, status transitions, and action-item extraction - `twin/meetings.py`: Calendar invite reader and attendee-context pre-meeting brief generator - `twin/email_adapter.py`: Read-only email normalization and thread grouping adapter - `twin/store.py`: Markdown + frontmatter persistence and duplicate-action supersession - `ea_shadow/broker.py`: Integer-coded `ActionBroker` enforcing `PAUSE`, `DRY_RUN`, and per-run token/request caps - `ea_shadow/run.py`: Fail-closed preflight checker and `SOURCE.template.md` contract - `bin/ea-demo.py`: Standalone local simulation of shadow triage and audit logging - `tests/`: 71-test suite covering GTD matter lifecycle, duplicate supersession, OB exclusions, and broker gates ## Invariants 1. Keep all organization names, credentials, domains, and thresholds in `.env` or external config files. Never hardcode company names, host IPs, or secrets in source files. 2. Deterministic business logic belongs in code and lookup tables, not inside LLM prompts. 3. Update `docs/HLD.md`, `docs/LLD.md`, and `.env.example` in the same commit whenever an interface or environment variable changes. 4. Run the repository smoke check and secret scan before opening a pull request. --- ## File: `docs/PRD.md` — Product Requirements Document (docs/PRD.md) # Product Requirements Document — Autonomous Executive Assistant & GTD Operating Loop A fail-closed, self-hosted AI Executive Assistant and GTD (Getting Things Done) operating loop that triages email threads into stateful matters, generates pre-meeting briefs from calendar invites and semantic memory, chases open commitments, and enforces `PAUSE`, `DRY-RUN`, token-budget, and outbox-isolation guardrails outside model discretion. ## 1. Problem Giving an autonomous LLM direct write access to your email, calendar, and notes is a security and reliability minefield: a prompt-injected email can trigger an outbound message, a retry loop can burn quota overnight, and stateless polling creates duplicate tasks every hour. This repository separates deterministic GTD state management (`twin/`) from a fail-closed shadow runner and action broker (`ea_shadow/`) so every proposed mutation is bounded, deduplicated, and auditable. ## 2. Users and Jobs-to-be-Done | Persona | Job-to-be-Done | |---|---| | Executive / Founder / VP | Wake up to deduplicated email matters (`action_needed`, `waiting_for`, `fyi`), pre-meeting context briefs, and overdue commitment chasers. | | Security-Conscious Self-Hoster | Run an unattended Grok, Claude, or local LLM assistant in `1010 DRY-RUN` shadow mode with a filesystem `PAUSE` switch and systemd cgroup limits. | | PKM / Obsidian User | Receive structured assistant outputs in `bot-inbox/ea/` without granting bots write access to authored vault folders. | ## 3. Core Capabilities - Stateful GTD Desk (`twin/desk.py`, `twin/store.py`, `twin/scanner.py`) mapping multi-message email threads into deduplicated matter files with explicit next owners and due dates. - Automated Pre-Meeting Briefs (`twin/meetings.py`, `twin/people.py`) resolving calendar attendees against historical threads and open commitments. - Fail-closed `ActionBroker` (`ea_shadow/broker.py`) with 4-digit integer state codes (`1000 EXECUTED`, `1010 DRY-RUN`, `1050 BLOCKED: pause`, `1060 BLOCKED: budget`). - Dormant-by-default preflight (`ea_shadow/run.py`), `SOURCE.template.md` specification contract, and hardened `systemd` unit/timer templates (`120s` timeout, zero auto-restart). - Zero-credential local simulation (`python3 bin/ea-demo.py`) and 71 passing unit tests (`tests/`). ## 4. Configurable Inputs Adopters configure the system for their own organization without editing core application logic: | Variable | Default / Example | Purpose | |---|---|---| | `EA_DRY_RUN` | `true` | Keep true in shadow mode so proposed mutations log 1010 DRY-RUN without executing | | `EA_STATE_DIR` | `~/.local/state/ea-bot` | Directory holding PAUSE flag and broker-audit.jsonl | | `EA_MAX_REQUESTS_PER_RUN` | `1` | Maximum model invocations permitted per scheduled tick | | `EA_MAX_TOKENS_PER_RUN` | `8000` | Hard token ceiling per run enforced by ActionBroker | | `VAULT_PATH` | `./sample-vault` | Read-only path to your Markdown knowledge vault | | `BOT_OUTBOX_PATH` | `./sample-vault/bot-inbox/ea` | Exclusive create-only directory for assistant note outputs | | `LLM_PROVIDER` | `grok` | Model CLI/provider backend (grok, claude, or local) | ## 5. Phasing and Stability Exit Criteria 1. **Phase 1 (Local Synthetic Run):** Clone the repository, copy `.env.example` to `.env`, and run the quickstart commands against synthetic seed data. Exit criterion: smoke checks pass with zero external credentials. 2. **Phase 2 (Read-Only Shadow Wiring):** Connect read-only credentials or webhook listeners in shadow/dry-run mode. Exit criterion: 100 consecutive events or queries reconcile cleanly against source records. 3. **Phase 3 (Production Cutover):** Enable live writes, alerts, or routing behind bounded retry and idempotency guards. ## 6. Non-Goals - Shipping organization-specific business rules hardcoded in application source. - Storing credentials, personal customer records, or tenant URLs inside version control. - Replacing deterministic validation or arithmetic with unconstrained model prompts. --- ## File: `docs/PR-FAQ.md` — Working-Backwards PR-FAQ (docs/PR-FAQ.md) # Working-Backwards PR-FAQ — Autonomous Executive Assistant & GTD Operating Loop **Release Summary:** `grok-ea-bot-public` gives engineering and operations teams a self-hosted, open-source implementation of Autonomous Executive Assistant & GTD Operating Loop that configures via `.env` and runs on standard infrastructure in minutes. ## Press Release Operations and engineering teams often rebuild the same internal workflows behind closed doors or pay per-seat SaaS markups for rigid tools that cannot match their field reality. `grok-ea-bot-public` open-sources a battle-tested implementation of Autonomous Executive Assistant & GTD Operating Loop, stripped of all single-company assumptions and packaged with clear adapter boundaries, synthetic demo data, and machine-readable agent documentation. Any team can fork `grok-ea-bot-public`, supply their own `.env` inputs and taxonomy config, and deploy locally or in production with Docker, Python, or Node. AI coding assistants such as Claude Code, Codex, and Cursor can read `AI-README.md` and `llms.txt` to wire custom ERP, CRM, or warehouse adapters in a single session. ## External Adopter FAQ **Q1: How long does it take to run locally after cloning?** Under five minutes. Copy `.env.example` to `.env` and run the quickstart commands in `README.md`. Synthetic fixtures let you inspect the workflow before connecting live credentials. **Q2: Do I need to rewrite source files to use my own company name, channels, or rules?** No. Organization names, endpoints, thresholds, and credentials sit in `.env` and declarative config files. External system specifics live behind narrow adapter modules documented in `docs/LLD.md`. **Q3: What license governs this repository?** MIT License. You can fork, modify, self-host, and use it commercially without restriction. ## Internal Engineering & Security FAQ **Q4: How do we prevent tenant or employer data from ever entering a public fork?** The repository starts from a clean git history, excludes raw exports and binary dumps, validates every commit through `gitleaks`, and ships only synthetic fixtures. **Q5: What happens when an upstream API or model provider is slow or unavailable?** Inbound webhooks persist raw payloads before processing, outbound writes carry idempotency keys with bounded exponential backoff, and model-backed paths fail open to deterministic rules or explicit human queues. --- ## File: `docs/HLD.md` — High-Level Design (docs/HLD.md) # High-Level Design (HLD) — Autonomous Executive Assistant & GTD Operating Loop A fail-closed, self-hosted AI Executive Assistant and GTD (Getting Things Done) operating loop that triages email threads into stateful matters, generates pre-meeting briefs from calendar invites and semantic memory, chases open commitments, and enforces `PAUSE`, `DRY-RUN`, token-budget, and outbox-isolation guardrails outside model discretion. ## 1. System Topology ```mermaid flowchart LR Mail["Read-Only Mail & Calendar"] --> Twin["twin/ GTD Matter Engine"] OB["Open Brain MCP (Search Only)"] --> Twin Twin --> Shadow["ea_shadow/ LLM Runner (1 req / 8K tok)"] Shadow --> Broker["ActionBroker (PAUSE · Budget · DRY-RUN)"] Broker -->|"1010 DRY-RUN / 1000 EXEC"| Audit["broker-audit.jsonl"] Twin -->|"create-only"| Outbox["bot-inbox/ea/*.md"] ``` ## 2. Architectural Decisions and Rejected Alternatives | Decision | Why It Holds | Rejected Alternative | |---|---|---| | Containment outside model prompts | Prompt instructions cannot stop prompt injection from untrusted emails; `PAUSE`, `DRY_RUN`, and read-only mounts enforce boundaries in OS/Python code. | Prompt-only 'ask before sending' rules | | Thread-to-Matter projection instead of per-email tasks | A 12-message email thread is one GTD matter whose state updates as replies arrive, preventing duplicate task explosion. | One task per unread email | | Exit 78 fail-closed preflight (`ea_shadow/run.py`) | Refuses unattended execution until `SOURCE.md`, schedule, and credential boundaries are explicitly provisioned. | Silent fallback defaults on unconfigured hosts | ## 3. Data Flow and Failure Boundaries 1. **Configuration Boundary:** Startup validates `.env` variables and declarative config schemas before accepting traffic or running scheduled jobs. 2. **Adapter Boundary:** External services (databases, chat channels, HRMS, warehouses, or LLM providers) sit behind explicit adapter modules so failures stay isolated and testable with local mocks. 3. **Observability and Audit:** State transitions and job executions emit structured logs and deterministic status records rather than mutating state silently. ## 4. Scaling Notes - **1x to 10x load:** Single-node Docker Compose or process supervisor handles standard team workloads with indexed database queries and bounded worker concurrency. - **First bottleneck at 10x+:** High-frequency webhook or batch ingestion queues; mitigate by separating the stateless HTTP receiver from background worker processes sharing Redis or PostgreSQL locks. --- ## File: `docs/LLD.md` — Low-Level Design & Runbook (docs/LLD.md) # Low-Level Design (LLD) & Operations Runbook — Autonomous Executive Assistant & GTD Operating Loop This document defines the module responsibilities, environment contract, and operational procedures for `grok-ea-bot-public`. ## 1. Module and File Inventory | Path | Responsibility | |---|---| | `twin/desk.py` | Core GTD matter triage, status transitions, and action-item extraction | | `twin/meetings.py` | Calendar invite reader and attendee-context pre-meeting brief generator | | `twin/email_adapter.py` | Read-only email normalization and thread grouping adapter | | `twin/store.py` | Markdown + frontmatter persistence and duplicate-action supersession | | `ea_shadow/broker.py` | Integer-coded `ActionBroker` enforcing `PAUSE`, `DRY_RUN`, and per-run token/request caps | | `ea_shadow/run.py` | Fail-closed preflight checker and `SOURCE.template.md` contract | | `bin/ea-demo.py` | Standalone local simulation of shadow triage and audit logging | | `tests/` | 71-test suite covering GTD matter lifecycle, duplicate supersession, OB exclusions, and broker gates | ## 2. Environment Variable Contract | Variable | Default / Example | Required | Description | |---|---|---|---| | `EA_DRY_RUN` | `true` | Yes | Keep true in shadow mode so proposed mutations log 1010 DRY-RUN without executing | | `EA_STATE_DIR` | `~/.local/state/ea-bot` | Yes | Directory holding PAUSE flag and broker-audit.jsonl | | `EA_MAX_REQUESTS_PER_RUN` | `1` | Yes | Maximum model invocations permitted per scheduled tick | | `EA_MAX_TOKENS_PER_RUN` | `8000` | Yes | Hard token ceiling per run enforced by ActionBroker | | `VAULT_PATH` | `./sample-vault` | Yes | Read-only path to your Markdown knowledge vault | | `BOT_OUTBOX_PATH` | `./sample-vault/bot-inbox/ea` | Yes | Exclusive create-only directory for assistant note outputs | | `LLM_PROVIDER` | `grok` | Yes | Model CLI/provider backend (grok, claude, or local) | ## 3. Extension Recipe 1. Run `python3 bin/ea-demo.py` and `pytest -q tests/` to inspect the GTD matter format and broker audit log locally. 2. Copy `ea_shadow/SOURCE.template.md` to `ea_shadow/SOURCE.md` and fill in your schedule, timezone, watched folders, and allowed read accounts. 3. Run in `EA_DRY_RUN=true` shadow mode for one full week, reviewing `broker-audit.jsonl` (`1010 DRY-RUN`) before unlocking any live write path. ## 4. Operations Runbook ### 1. Emergency pause all scheduled assistant runs ```bash touch ~/.local/state/ea-bot/PAUSE # every subsequent run logs 1050 BLOCKED: pause ``` ### 2. Resume shadow dry-run mode ```bash rm -f ~/.local/state/ea-bot/PAUSE && export EA_DRY_RUN=true ``` ### 3. Inspect recent broker decisions ```bash tail -n 20 ~/.local/state/ea-bot/broker-audit.jsonl ``` ### 4. Run full regression suite ```bash pytest -q tests/ ``` --- ## File: `docs/RESEARCH-2026.md` — 2026 Research & Landscape Notes (docs/RESEARCH-2026.md) # 2026 Autonomous Executive Assistant Research & Safety Design `grok-ea-bot-public` implements a self-hosted GTD (Getting Things Done) operating loop and Executive Assistant designed around **structural containment** rather than prompt-level promises. ## 1. Comparison with 2026 Open-Source AI Executive Assistants | Project | Strengths | Operational Gap Closed Here | |---|---|---| | `langchain-ai/executive-ai-assistant` | Rich LangGraph Gmail/Calendar OAuth triage & Agent Inbox UI | Gives the LLM process direct OAuth tool reach; lacks OS-level read-only vault + outbox isolation and integer-coded shadow mode. | | `n8n` AI Triage Workflows | Visual branching and quick webhook setup | Hard to version-control complex thread-to-matter deduplication or run 70+ deterministic unit tests offline. | | **This Repo (`grok-ea-bot-public`)** | Deterministic GTD thread->matter state machine (`twin/`), pre-meeting brief builder, fail-closed `ActionBroker` (`1010 DRY-RUN`, `1050 PAUSE`, `1060 BUDGET`), and systemd cgroup bounds | Built specifically so an untrusted email body cannot trigger an unauthorized external write or corrupt human-authored notes. |