Productivity (Layer 3)

Layer 3 provides the tools for structured, repeatable interactions with the AI agent.

Compose Buffer (C-c e)

A magit-style multi-line editor for writing prompts. Opens at the bottom of the frame:

┌─────────────────────────────────────────────┐
│  *agent-shell*<my-session>                  │
│                                             │
│  ... conversation ...                       │
│                                             │
├─────────────────────────────────────────────┤
│  Compose prompt → C-c C-c submit, C-c C-k  │
│                                             │
│  Please refactor the UnrecoverableError     │
│  handler to support a new category:         │
│                                             │
│  - Add `TransientNetworkError` subclass     │
│  - Wire it into the metrics recorder        │
│  - Update the Terraform alert definitions   │
│                                             │
└─────────────────────────────────────────────┘
  • C-c C-c — submit the composed text to the agent
  • C-c C-k — cancel and close the compose buffer
  • C-c C-s — toggle sticky (stays open after submit) vs transient (closes after submit)
  • C-c k k — interrupt the agent, C-c k C-c — interrupt and submit
  • Full text-mode editing: RET for newlines, no accidental submissions

Prompt History (M-p / M-n)

The compose buffer supports prompt history across all sessions — cycle through previously sent prompts:

KeyAction
M-pPrevious prompt (older)
M-nNext prompt (newer)
M-rSearch all prompts (consult fuzzy match)

History is loaded lazily from auggie session files — M-p starts with the current session, then progressively loads older sessions as you keep pressing. M-r provides a full fuzzy search across all sessions using consult.

Your current input is saved when you start navigating and restored when you cycle past the newest entry.

Yasnippet Prompt Templates (C-c t t)

Seven built-in templates with interactive fields:

TemplateKeyPurpose
/reviewC-c t t → reviewCode review with focus selector (bugs, performance, security, readability)
/refactorC-c t t → refactorRefactoring with pattern selector (extract, rename, DRY up, etc.)
/testC-c t t → testTest generation covering happy path, edge cases, errors
/explainC-c t t → explainCode explanation with aspect focus
/fixC-c t t → fixBug fix with stack trace placeholder
/implementC-c t t → implementFeature implementation following existing patterns
/debugC-c t t → debugDebugging with logs and steps-taken fields

Templates auto-populate the current file from the source buffer. TAB advances between fields; yas-choose-value provides dropdown selectors.

Creating Templates

  • C-c t n — create a new yasnippet template
  • C-c t e — edit an existing template

Templates are stored in ~/.emacs.d/snippets/agent-shell-mode/.

Custom Slash Commands (C-c c c)

Slash commands are markdown files with YAML frontmatter, deployed to ~/.augment/commands/:

---
description: Create a new session from a Jira ticket key
argument-hint: [session name or JIRA-KEY]
---

Create a new Augment session and rename it in one step.
...

Built-in Commands

CommandDescription
/startCreate a new session from a Jira ticket key or plain name
/find-sessionSearch all saved sessions by keyword (up to 500)
/pivot-conversationHard pivot — discard current plan, re-evaluate
/step-backStop, summarise progress, wait for direction

Command Discovery

The picker (C-c c c) scans both global (~/.augment/commands/) and project-level (.augment/commands/) directories. Each command shows its scope and description:

Command:
  /start           (global)  Create a new session from a Jira ticket key
  /find-session    (global)  Search all saved sessions by keyword
  /pivot-conversation (global)  Hard pivot — discard current plan
  /deploy-check    (project) Verify deployment prerequisites

Nix-Managed vs Runtime Commands

Nix-managed commands are deployed as symlinks. User-created commands are regular files. On decknix switch, Nix refreshes its symlinks; runtime-created commands persist untouched.

Session Tagging (C-c T)

Tag sessions with freeform labels for organisation:

KeyAction
C-c T tAdd a tag (with completion from existing tags)
C-c T rRemove a tag
C-c T lFilter sessions by tag → resume picker
C-c T eRename a tag across all sessions
C-c T dDelete a tag globally
C-c T cCleanup orphaned tags (sessions that no longer exist)

Tags are stored in ~/.config/decknix/agent-sessions.json, keyed by auggie session ID. The session picker shows tags inline:

[saved] a1b2c3d4  2h ago  12x  Fix pubsub timeout... [proptrack, bug]

Quick Actions

PR Review (C-c c r / C-c A c r)

Start a code review session for a GitHub PR:

  1. Prompts for PR URL (auto-detects from clipboard)
  2. Creates a named session: Review: owner/repo#123
  3. Tags the session with review and sends /review-service-pr <url>

Batch Process (C-c c B / C-c A c B)

Launch multiple sessions from a single editor — ideal for batch code reviews or parallel investigations:

┌─────────────────────────────────────────────┐
│  Batch: C-c C-c submit | C-c C-k cancel    │
│                                             │
│  # Batch session launcher — workspace: ~/.. │
│  --- backend : ~/Code/my-project            │
│  https://github.com/org/api/pull/42         │
│  https://github.com/org/api/pull/43         │
│                                             │
│  --- frontend                               │
│  https://github.com/org/web/pull/17         │
│                                             │
└─────────────────────────────────────────────┘

Syntax:

  • --- <name> [: <workspace>] — group header (items below launch as one session)
  • Ungrouped URLs — each gets its own session
  • # lines — comments, ignored

Snippets (via yasnippet in batch compose mode):

KeySnippetDescription
---Group header--- <name> : <workspace> with tab stops
prPR URLGeneric github.com/<owner>/<repo>/pull/<number>

Org-specific snippets (e.g., pre-filled workspace paths) can be added via downstream decknix-config.

C-c C-c parses the buffer and launches all sessions. A summary buffer shows success/failure for each.

Nix Options

programs.emacs.decknix.agentShell = {
  templates.enable = true;  # Yasnippet prompt templates
  commands.enable = true;   # Nix-managed slash commands
};