---
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.

<problem_patterns>
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.
</problem_patterns>

<architecture_map>
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
</architecture_map>

<inputs_and_configuration>
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.
</inputs_and_configuration>

<adaptation_playbook>
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.
</adaptation_playbook>

<reference_docs>
- 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`
</reference_docs>
