~/.ollim-bot/ directory and what it does.
All persistent data lives in ~/.ollim-bot/. The directory is created on
first use and automatically managed as a git repository — storage.py
auto-commits after most writes.
Set the
OLLIM_DATA_DIR shell env var to relocate the directory — for
example, OLLIM_DATA_DIR=~/.ollim-bot-2 ollim-bot runs a second instance
with a separate data dir. It must be a shell env var (not in .env)
because storage.py is imported before load_dotenv(). See
Configuration reference.tool-policy.yaml) that the
agent reads and writes directly. Infrastructure state (sessions, credentials, ping
budget, etc.) lives in the state/ subdirectory, keeping the agent’s
working directory clean. The state/ directory is write-protected
from agent tool access — a PreToolUse hook blocks Write and Edit calls
targeting paths inside state/. See
Permissions
for details.
Profile files
Two markdown files in the data directory root customize the bot’s persona and provide context about you. Both are prepended to the system prompt — see System prompt for how they compose into the final prompt.
See Customize personality and
Tell the bot about yourself for
editing guidance and examples.
Downloads
Non-image Discord attachments (PDFs, text files, spreadsheets, etc.) are saved todownloads/ so the agent can read them with its Read
tool. Filename collisions are handled with numeric suffixes
(file-2.txt, file-3.txt). This directory is created on first use.
See File attachments
for user-facing details.
Session files
All files in this section and below live in thestate/ subdirectory.
These files track the agent’s conversation state across restarts.
Session events
Each line insession_history.jsonl contains:
session_history.jsonl
Compaction is detected two ways: the
/compact command detects it
via the compact_boundary SystemMessage from the SDK, while
save_session_id() catches SDK auto-compaction by detecting session
ID changes. A _swap_in_progress flag suppresses false compacted
events during swap_client().Fork and inquiry files
These files track ephemeral Discord interaction state. Both use a 7-day TTL — entries older than 7 days are pruned on every read.fork_messages.json
fork_messages.json
inquiries.json
inquiries.json
Pending updates
Background forks write summaries topending_updates.json via the
report_updates MCP tool. The main session reads and clears these on
its next turn.
pending_updates.json
Concurrent background forks use an
asyncio.Lock to protect the
read-modify-write cycle on this file, preventing lost updates.Reflections
After every background fork finishes, a lightweight Haiku meta-fork writes a short execution trace toreflections/<item-id>/<timestamp>.md.
These traces are for your own debugging and history review — nothing
is sent externally.
reflect: false in a job’s YAML frontmatter to skip this
per job. See Reflections
for the full behavior.
Ping budget
ping_budget.json stores the refill-on-read token bucket state for
proactive pings. This file is not git-committed — it is ephemeral
state that resets naturally.
ping_budget.json
On every
load(), time-based refill is computed and daily counters are
reset if the date has changed. The updated state is saved back
immediately.
Runtime configuration
config.json stores persistent settings you configure via /config. These
include per-context model and thinking defaults, timeouts, and the default
permission mode. See Configuration reference for the full key listing.
This file is not git-committed — it is local configuration that may
vary between instances.
Agent-managed directories
Routines, reminders, webhooks, and skills are each stored as files in their own subdirectory. For routines, reminders, and webhooks, filenames are auto-generated slugs from the message content (max 50 characters) and theid field in YAML frontmatter is authoritative. Skills use a
different structure: each skill is a directory named after the skill,
containing a SKILL.md file.
Routines, reminders, webhooks, and skills use the same storage format: YAML frontmatter delimited by
---, followed by a markdown body. See
File formats for the full field specs.
routines/morning-briefing.md
SDK layout directory
The.claude/ directory is the Agent SDK’s expected layout for discovering
subagents and skills. _ensure_sdk_layout() in main.py creates it
automatically at startup.
Both paths work because the bot sets
cwd=DATA_DIR and
setting_sources=["project"] — the SDK resolves .claude/ relative to
the working directory.
Google credentials
Neither file is git-committed.
token.json is auto-generated
when you run /google-auth.
Process lock
bot.pid contains the PID of the running bot process. On startup,
_check_already_running() reads this file and uses os.kill(pid, 0) to
check if the process is alive. On Linux, it additionally verifies
/proc/<pid>/cmdline contains ollim-bot to avoid false positives from
recycled PIDs. Corrupted PID files (non-numeric content or read errors) are
silently overwritten. The file is deleted on exit via atexit.
Git tracking
The~/.ollim-bot/ directory is initialized as a git repository.
storage.py auto-commits after writes to most files. Files that are
not git-committed:
All other files — profile files, session history, routines, reminders,
webhooks, and skills — are auto-committed on every write.
Next steps
File formats
YAML frontmatter specs for routines, reminders, webhooks, and skills.
Configuration reference
Environment variables and .env file setup.
Ping budget
How the refill-on-read token bucket controls proactive pings.
Set up Google integration
Connect Google Tasks, Calendar, and Gmail.
