⭐️ Working with agents and the command line

Moment has a built-in terminal window that gives you access to any of the following shells or installed agents:

zsh — The Z shell, a Unix shell and command interpreter that's the default on macOS, with rich tab completion, globbing, and scripting features.

Amp — Sourcegraph's coding agent, optimized for navigating and editing large codebases with deep semantic search.

Claude Code — Anthropic's official CLI agent, powered by Claude, with strong reasoning and tool-use for end-to-end software engineering tasks.

Codex — OpenAI's command-line coding agent, designed for autonomous, multi-step development work in your terminal.

Copilot — GitHub's AI pair programmer in CLI form, with tight integration into the GitHub ecosystem and pull-request workflows.

Gemini — Google's CLI coding agent, powered by Gemini models, with broad multimodal capabilities and Google Cloud integration.

How to select a shell or agent

The currently selected shell or agent is shown in the CLI selector in the lower right corner of the application. To select the shell or agent you want to work with, click the drop down arrow on the CLI selector. A list opens, showing the available CLIs and agents:

A check mark indicates the current choice. Click any other available item to make it the new current choice. Any unavailable items will be disabled and marked as “not found.”

How to work in a terminal window in Moment

Clcik the main portion of the CLI selector, to open up that shell or agent.

A terminal window opens in the lower third of the application. It supports multiple tabs:

By default, terminal windows open in topmost directory of the current document. This means that any manipulations you perform in the terminal window will default to operating on the current document.

How to use AI agents in Moment

Moment makes it easy to invoke AI agents like Claude Code or Codex. By default agents operate within a single document folder. They can be used to perform nearly any type of automated process on one or more pages of a document.

Coding agents can be used for both coding and non-coding tasks. Examples include:

Coding tasks

Build interactive dashboards — Ask an agent to create a JavaScript code cell that fetches data from an API (e.g., GitHub PRs, Kubernetes pods, AWS resources) and renders it as a sortable, filterable React table.

Wire up request pages — Have an agent generate HTTP, Postgres, SQLite, or gRPC request pages, including {{vars.X}} template variables and {{env.X}} secret substitution.

Query attached data — Drop a CSV or SQLite file into .moment/attachments/ and ask the agent to write SQL against it and chart the results.

Refactor cells — Have the agent split a large code cell into smaller named cells, extract React components into their own cells, or migrate inline styles to Tailwind classes.

Debug runtime errors — Point the agent at .moment/runtime-errors.log or .moment/diagnostics/{pageId}/snapshot.log and ask it to diagnose and fix failing cells.

Add mutations — Generate mutation() handlers, forms, and onSettled query invalidations for POST/PUT/DELETE flows against your APIs or Postgres tables.

Glue services together — Build a small internal tool that calls one API, transforms the result, and posts it to another (e.g., pull Linear issues, summarize, post to Slack).

Non-coding tasks

Draft and edit prose — Ask the agent to write, restructure, or proofread Markdown pages, expand outlines into full drafts, or tighten existing copy.

Reorganize a document — Have the agent rename pages, restructure the page hierarchy in moment.yml, fix broken [[wiki-style]] links, or split a long page into child pages.

Summarize and extract — Point the agent at a long page, an attached PDF, or a query result and ask for a TL;DR, action items, or a structured table.

Research and synthesize — Ask the agent to gather information from the web and write it up as a new page with citations and internal links.

Generate runbooks and SOPs — Describe a workflow in plain English and have the agent produce a step-by-step runbook page, complete with embedded request pages for the actual operations.

Translate and reformat — Convert between Markdown, tables, JSON, and YAML; localize content; or rewrite a page for a different audience.

Triage and label — Have the agent read a list of items (PRs, tickets, leads) and tag, categorize, or prioritize them on a page.

AGENTS.md and CLAUDE.md

Moment creates AGENTS.md (and CLAUDE.md) files for each document. The instructions in these files make Moment understandable to agents. These files make it possible to build and manipulate complicated documents and pages in Moment because the agents have all of the information they need to build and alter Moment pages.

To review the AGENTS.md file, click Agents in the side bar then click AGENTS.md

The main Moment windo updates to let you view the existing AGENTS.md file (in a local markdown editor on your computer) or to add custom instructions that are appended to the AGENTS.md file used by the current document.