olkcli CLAUDE.md

Repository instructions for olk, a command-line tool for Outlook and OneDrive through Microsoft Graph. It provides terminal access to email, calendars, contacts, tasks, and files.

In plain words
What is it for?
Building, testing, linting, and safely changing the Go-based Outlook and OneDrive command-line tool.
Why use it?
They explain the project’s commands, architecture, authentication, and a macOS Keychain prompt that requires human approval.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/rlrghb/olkcli/claude-md
Clone the repo
git clone --depth 1 https://github.com/rlrghb/olkcli
Per session 3,383 This file is loaded in full into every session.
When invoked 3,383 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.03383 $0.03383
Opus 5 $0.01691 $0.01691
Sonnet 5 $0.00677 $0.00677
Haiku 4.5 $0.00338 $0.00338

Measured 3d ago against content hash 4e3783581cf5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

olkcli CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 137 lines

How it starts

The opening of the file, as written. The whole thing — 137 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides context for Claude Code when working on the olk project.

What is this project?

olk is a CLI tool for Microsoft Outlook and OneDrive via the Microsoft Graph API. It provides terminal access to email, calendar, contacts, tasks, and OneDrive files for both personal Microsoft accounts and enterprise Azure AD/Entra ID accounts.

Quick Reference

make build          # Build binary to ./bin/olk
make test           # Run tests
make lint           # Lint with golangci-lint
go mod tidy         # After changing dependencies

Validating on macOS: running a freshly built ./bin/olk against a real account triggers a macOS Keychain access prompt (each build is a new identity). A human must click "Always Allow" — you (an agent) can't dismiss the dialog, so don't treat a first-run hang as a bug; ask the user to approve it.

Architecture

  • CLI framework: github.com/alecthomas/kong — commands are Go structs with Run(ctx *RunContext) error
  • Auth: Raw OAuth2 against login.microsoftonline.com — no MSAL. Two flows: device code (default) and authorization-code + PKCE via system browser with a loopback listener (--browser, in internal/msauth/authcode.go) for tenants whose Conditional Access requires a compliant device or blocks device code. Both use PKCE (RFC 7636). Scopes defined in internal/msauth/scopes.go. Enterprise-only scopes (MailboxSettings.ReadWrite, User.ReadBasic.All) are only requested with --enterprise flag — personal accounts cannot consent to them. Token refresh is serialized per-email via sync.Map of mutexes to prevent race conditions
  • API: Official msgraph-sdk-go wrapped in internal/graphapi/ for ergonomic access
  • Secrets: OS keyring via github.com/99designs/keyring (macOS Keychain, Linux Secret Service, Windows WinCred). File-backend password prompt writes to stderr (not stdout) to avoid corrupting piped output. Set OLK_KEYRING_PASSWORD for headless/non-interactive use
  • Output: JSON envelope (--json), aligned table (default), TSV (--plain)
  • Provider parity: calendar JSON supports opt-in --body-format text|html, stable/lifecycle metadata, structured attendee responses, and lossless recurrence details. Mail and contact list/get/delta results expose provider synchronization IDs and timestamps. Calendar writes support --transaction-id, --no-reminder, --location none, and --all-day/--timed with validation.
  • MCP server: olk mcp (in internal/cmd/mcp*.go) runs a stdio Model Context Protocol server exposing a curated allowlist of read-first tools (curatedTools in mcp_server.go) — NOT the whole command tree. Tool calls reparse a rebuilt argv and run in-process with stdout captured under a mutex (mcp_capture.go). Read-only by default; --allow-write <tool> exposes a named curated safe-write tool (per-tool opt-in). No HTTP transport
  • Capability guards: --no-write/--no-send are enforced once at the graphapi.Client layer (ensureWritable/ensureMaySend), so the guarantee holds across CLI, MCP, and scripts. --enable-commands[-exact]/--disable-commands gate dispatch via commandAllowed() (commands.go), checked in Execute() and reused to filter the MCP registry. --wrap-untrusted wraps untrusted:"true"-tagged struct fields in JSON/plain output (internal/outfmt/untrusted.go)
  • Timezone: Display-layer conversion via outfmt.ConvertTime(). Resolved once per command via RunContext.Timezone() (flag > env > config > Local). JSON output emits UTC timestamps as RFC3339 with a Z suffix (normalized via normalizeGraphUTC — Graph's DateTimeTimeZone.dateTime strings lack a zone); envelope includes timezone field. IANA db embedded via import _ "time/tzdata"

Read the full file on GitHub · 137 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 137 lines · 3,383 tokens per session scan A 4e3783581cf5

Subscribe to this mod's changes

olkcli CLAUDE.md is an instructions file published in the GitHub repository rlrghb/olkcli (17 stars, last pushed 4d ago), licensed MIT. It adds 3,383 tokens to every session, about $0.0169 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.