Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/remorses/kimaki/llms.txt

Use this file to discover all available pages before exploring further.

Utility commands help you manage message queues, undo mistakes, and maintain your Kimaki installation.

/queue

Queue a message to send automatically after the current response finishes.

Parameters

  • message (required) - The message to queue

Usage

/queue message:"Now add error handling"

Behavior

If a session is actively responding:
  1. Adds the message to the queue for that thread
  2. Shows: “Message queued (position: 1). Will be sent after current response.”
  3. When the current response completes, sends the queued message automatically
If no session is active:
  1. Sends the message immediately
  2. Shows: ”» Your Name: Now add error handling”
Queueing vs. Sending: Use /queue instead of regular messages to avoid interrupting the AI mid-response. Queued messages send in order after each response completes.

Example Workflow

You: "Add user authentication"
AI: [implementing auth...]

/queue message:"Now add tests"
/queue message:"Update the README"

→ Queue:
  1. "Now add tests"
  2. "Update the README"

AI: [finishes auth]
→ Sends "Now add tests" automatically

AI: [writing tests...]
AI: [finishes tests]
→ Sends "Update the README" automatically

Multiple Users

Each thread has its own queue shared by all users:
User A: /queue message:"Fix the bug"
User B: /queue message:"Add logging"

→ Queue:
  1. User A: "Fix the bug"
  2. User B: "Add logging"
Messages are processed in the order they were queued.

/clear-queue

Clear all queued messages in the current thread.

Parameters

None.

Usage

/clear-queue

Behavior

  1. Removes all messages from the thread’s queue
  2. Shows: ”🗑 Cleared 3 queued messages”
  3. Does not affect the currently running response
No Undo: Clearing the queue is permanent. Queued messages are lost.

When to Use

  • You queued messages but changed your mind
  • The AI is heading in a different direction
  • You want to abort and start fresh
Thread Only: /clear-queue only works in threads. Each thread has an independent queue.

/undo

Undo the last assistant message, reverting all file changes it made.

Parameters

None.

Usage

/undo

Behavior

1
Find Last Assistant Message
2
Kimaki fetches all messages in the session and finds the most recent assistant message.
3
Call OpenCode Revert API
4
Calls session.revert({ sessionID, messageID }) to revert that message.
5
Revert File Changes
6
OpenCode reverts all file edits made by that message using git:
7
git apply --reverse [diff]
8
Show Diff
9
Kimaki shows what was reverted:
10
⏪ Undone - reverted last assistant message

```diff
- export function auth() {
-   return true;
- }
11

</Steps>

<Note>
**Git Required**: Undo uses git to revert changes. It only works in git repositories.
</Note>

### Multiple Undos

You can undo multiple times:

12
/undo → Reverts message 3 /undo → Reverts message 2 /undo → Reverts message 1
13

Each `/undo` reverts the most recent assistant message that hasn't been undone yet.

### What Gets Reverted

- **File edits**: `write`, `edit` tool calls
- **Deleted files**: Restored from git
- **New files**: Removed

**Not reverted**:
- Bash commands (can't undo side effects)
- External API calls (MCP tools)
- Manual changes you made after the message

## /redo

Redo the last undone message, restoring the changes.

### Parameters

None.

### Usage

14
/redo
15

### Behavior

1. Checks if the session has a revert state
2. Calls `session.unrevert({ sessionID })` to restore the changes
3. Shows: "⏩ Restored - session back to previous state"

<Note>
**Single Redo**: Kimaki only tracks the most recent undo. You can't redo multiple times.
</Note>

### Undo/Redo Example

16
AI: [makes changes]
17
/undo → Changes reverted
18
/redo → Changes restored
19
/undo → Changes reverted again
20

### When to Use

- You undid by mistake
- You reviewed the changes and decided they were good
- You want to compare before/after by toggling undo/redo

## /upgrade-and-restart

Upgrade Kimaki to the latest version and restart the bot.

### Parameters

None.

### Usage

21
/upgrade-and-restart
22

### Behavior

<Steps>

### Check for Updates

Kimaki checks npm for the latest published version:

```bash
npm view kimaki version
23
Compare Versions
24
If the npm version is newer than the running version:
25
Current: v1.0.5
Latest:  v1.0.8
26
Install Latest
27
Runs npm install globally:
28
npm install -g kimaki@latest
29
Spawn New Process
30
Starts a new kimaki process in the background:
31
kimaki [original args]
32
New Process Takes Over
33
The new process:
34
  • Binds the lock port
  • Detects the old process is running
  • Sends SIGTERM to kill it
  • Takes over all connections
  • Graceful Restart: Active sessions continue seamlessly. The new process reconnects to existing threads.

    Version Display

    If already on the latest version:
    Already on latest version: v1.0.8
    
    After upgrade:
    Upgraded kimaki v1.0.5 → v1.0.8. Restarting bot...
    

    Manual Restart

    You can also restart without upgrading:
    # Find the process ID
    ps aux | grep kimaki
    
    # Send SIGUSR2 signal
    kill -SIGUSR2 <PID>
    
    The bot restarts with the same version.

    Queue Internals

    Kimaki manages queues in-memory:
    const messageQueues = new Map<string, QueuedMessage[]>()
    
    type QueuedMessage = {
      prompt: string
      userId: string
      username: string
      queuedAt: number
      appId?: string
      command?: { name: string; arguments: string }
    }
    
    Queue lifecycle:
    1. User runs /queue
    2. Message added to messageQueues.get(threadId)
    3. Current session completes
    4. session-handler checks queue
    5. Pops first message and sends it
    6. Repeats until queue is empty
    Queue clearing:
    • /clear-queue empties the array
    • /abort clears the queue for that session
    • Bot restart clears all queues (in-memory only)

    Best Practices

    When the AI is working, queue your next tasks instead of waiting:
    AI: [implementing feature A...]
    You: /queue message:"Now do feature B"
    You: /queue message:"Then do feature C"
    
    → All three features complete without you waiting
    
    If the AI makes a mistake, undo immediately:
    AI: [renames files incorrectly]
    You: /undo
    You: "Actually, keep the original names and just update the imports"
    
    This is faster than asking the AI to fix it manually.
    Run /upgrade-and-restart weekly to get:
    • Bug fixes
    • Performance improvements
    • New features
    The upgrade is seamless with no downtime.

    Error Handling

    Common errors and solutions:
    No active session in this thread
    → /queue, /clear-queue, /undo, /redo only work in session threads
    
    No messages to undo
    → The session has no assistant messages yet
    
    Nothing to redo - no previous undo found
    → Use /undo first, then /redo
    
    Failed to undo: not a git repository
    → Undo requires git. Initialize a repo with `git init`
    
    Upgrade failed: permission denied
    → Run with sudo: sudo npx kimaki@latest (for global install)
    

    Build docs developers (and LLMs) love