Skip to content

Conversation

@ElleNajt
Copy link
Contributor

Summary

Adds a command station for managing multiple Claude instances across projects with org mode task tracking and workspace navigation.

Note: Still experimenting with the best way to structure this workflow, opening as draft to gather feedback.

Features

Multi-Instance Command Station

  • Single org file (~/.claude/taskmaster.org) tracks all Claude activities across projects
  • Clickable notifications with ESC dismissal using overriding-local-map
  • Navigate between workspaces containing Claude buffers via perspective.el
  • Uses Claude Code's native Notification and Stop event hooks

New Commands

  • claude-code-goto-recent-workspace (C-c c w) - Navigate to most recent workspace with Claude activity
  • claude-code-goto-recent-workspace-and-clear (C-c c W) - Navigate and mark org entry as done
  • claude-code-setup-hooks - Configure notification hooks for multi-instance tracking

Technical Implementation

  • New file: claude-code-org-notifications.el
  • Timestamped entries with clickable workspace links in org mode
  • "Go to Workspace" and "Clear and Go to Workspace" action buttons
  • Evil mode integration (enters insert mode when navigating to Claude buffers)
  • Buffer-based workspace detection using persp-buffers

Environment Variable Integration

  • Claude Code automatically exports CLAUDE_BUFFER_NAME environment variable to shell sessions
  • Hook commands receive buffer name (e.g., *claude:/path/to/project:default*) via $CLAUDE_BUFFER_NAME
  • This enables hooks to identify which specific Claude instance triggered the notification
  • Used in emacsclient commands to pass buffer context to notification handlers

Installation

The notification system is loaded automatically via claude-code.el. To enable org mode notifications:

(claude-code-setup-hooks)

Optional dependency: perspective.el for workspace features

Use Case

Track and navigate between multiple Claude instances running in different project directories from a single command station, with persistent task logging and quick workspace switching.

Test Plan

  • Run claude-code-setup-hooks and verify ~/.claude/settings.json is created with notification hooks
  • Start Claude instance and complete a task, verify entry appears in ~/.claude/taskmaster.org
  • Verify notification popup appears with clickable buttons when Claude buffer not visible
  • Test ESC key dismisses notification popup
  • Test "Go to Workspace" button switches to correct workspace and buffer
  • Test "Clear and Go to Workspace" button clears org entry and switches workspace
  • Test C-c c w command navigates to most recent workspace
  • Test C-c c W command navigates and clears org entry
  • With evil mode enabled, verify entering insert mode when navigating to Claude buffers
  • Test with multiple Claude instances across different projects
  • Verify workspace detection works with perspective.el

🤖 Generated with Claude Code

claude-code.el Outdated
(when claude-code-enable-notifications
(funcall claude-code-notification-function
"Claude Ready"
"Claude Reay"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@stevemolitor
Copy link
Owner

I haven't had a chance to try this yet, but this looks amazing and useful. I will try this out and give more detailed feedback in a few days.

Here are some initial thoughts. I've only looked things over quickly, so I apologize if some of these things don't make sense.

I'm trying to have claude-code.el use built-in features where practical. For example, I use the built-in project.el over projectile. Given that, is it possible to use tab-bar-mode instead of perspective.el? If not, optional dependencies (as you have done) are ok.

Using hooks for notifications is a great idea, and something I've been meaning to add. So it might be possible to pull out your hooks and notifications work out into a separate PR. I think there will be lots of use cases for hooks and notifications.

@ElleNajt
Copy link
Contributor Author

ElleNajt commented Jul 16, 2025

@stevemolitor (oops was writing as you were writing) one intention with this PR at the moment is also to think about overall architecture of this.

I'm using this in my workflow and it's useful but not yet achieving the multi tasking flow I'm looking for --

Maybe it's missing some queue cycling layer, where e.g. if I have multiple Claude waiting for response, responding to one automatically pops me to the next in the queue.

The taskmaster.org machinery I added here would make that straightforward as long as I can capture user replies happening. Or can use some shortcut to proceed without capturing.

(Also tbc this is largely vibe coded right now, I will make a closer pass before marking it as not a draft.)

@stevemolitor
Copy link
Owner

I checked out this PR and tried it out. This isn't a code review because I understand you're looking for higher level feedback and are still working out the ideal flow.

First of all, I love the concept. I think you're on to something useful. I really like the idea of a persistent, global claude notifications queue. I also like that it uses org, because I like org!

I don't use perspective, and did not test the perspective.el integration. As I mentioned above, I prefer using built-in facilities where practical. But I am curious about how you use perspective.el in your claude code workflow. I think the built-in tab-bar-mode is roughly equivalent, but I haven't really explored either yet.

I do use display-buffer-alist to control the display of the Claude buffer and org-agenda buffers. For example, whenever I open a "claude..." buffer, it opens in a right side window. That works for me but I am curious about layout manager workflows.

I appreciate that you made the perspective.el dependency optional. I'd remove the "Go to workspace" and "Clear and go to workspace" actions if perspective mode is not running. But I'd still want a generic "Clear" action. I'm still wondering if perspective integration is needed at all though.

Since there could be different workflows and approaches, I'd start with a PR that provides some basic claude code hooks integration, something along these lines:

  • Add CLAUDE_BUFFER_NAME to the claude process env (as you've already done here)
  • Add claude-code-notification-hook and claude-code-stop-hook hook variables.
  • Add 'claude-code--run-notification-hooksandclaude-code--run-stop-hooks`
  • Add a generic claude-code-setup-hooks function that calls:
    • claude-code--run-notification-hooks
    • claude-code--run-stop-hooks
  • Add examples to README. For example, how to "ding" in response to a notification and pop open the claude buffer.

That could unleash a lot of creativity for claude-code.el users. I'm curious to see what users will come with.

I'd then build your queue and workflow on top of that. I love the idea of putting the queue in an org file! I'd consider adding org categories or tags to indicate the directory (and/or project?) name. Then you could use org-agenda to create filtered agenda views by project, 'TODO' vs 'DONE', etc. Personally, I probably would use agendas and wouldn't use claude-code-browse-queue much. But other users wouldn't be familiar with org so it might still be useful.

What I'd really love is to be able to invoke hot-key actions in an agenda view to jump to the claude buffer from a queue item, etc.

Finally, and I wouldn't worry about this yet, I'm slowly implementing IDE integration including custom diff views to accept diffs. It'd be interesting option to include a proposed change diff notification in your queue, collapsed under the org heading in a src block, and an action to accept or reject the same.

So many possibilities! I'd start with the foundation first and build on that.

This is super cool!

@ElleNajt
Copy link
Contributor Author

ElleNajt commented Jul 22, 2025

Thanks for the comments!

The main way I'm using workspaces here is that in my workflow I typically have my projects organized in different workspaces, with a claude instance for each one (along with some files open, vterm, etc.). The perspective integration lets me jump to that whole workspace segup instead of a particular buffer. Also by jumping to workspaces I don't mess up my arrangement of buffers.

I will investigate if this can be done with tab-bar mode, or maybe it can be set up to work with either. (I don't understand the space of workspace management solutions well, I'm just using the doom defaults for tab / workspace mangement.)

I'd consider adding org categories or tags to indicate the directory (and/or project?) name. Then you could use org-agenda to create filtered agenda views by project, 'TODO' vs 'DONE', etc.

I like this, yes! :) Also like the idea of putting more information from the buffer in there too, e.g. the diff
(At the moment I have some filtering so that only the most recent item appears per claude buffer in the agenda at once, with the assumption that previous ones were dealt with already.)

What I'd really love is to be able to invoke hot-key actions in an agenda view to jump to the claude buffer from a queue item, etc.

I like that, yeah. Currently, I'm getting a lot of mileage out of the C-c c w and C-c c [,] commands I set up to cycle through the waiting responses from claude.

I agree regarding the smaller PR for the claude code hook integration, will start there. :)

@stevemolitor
Copy link
Owner

I agree regarding the smaller PR for the claude code hook integration, will start there. :)

Sounds great thanks!

@ElleNajt
Copy link
Contributor Author

ElleNajt commented Jul 23, 2025

PR here: #70

ElleNajt and others added 3 commits July 23, 2025 01:42
This commit adds comprehensive hook integration between Claude Code CLI and Emacs:

- Add claude-code-hook variable and claude-code-handle-hook function to receive hook events from CLI
- Set CLAUDE_BUFFER_NAME environment variable in terminal processes for hook context
- Pass through JSON data from Claude Code CLI stdin to Emacs hook handlers via temporary files
- Update README with detailed hooks documentation and configuration examples
- Add examples/hooks/ directory with hook handler examples and CLI settings template
- Support for notification, stop, pre-tool-use, and post-tool-use hook types

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Replace temp file approach with direct JSON passing via emacsclient args
- Rename claude-code-hook to claude-code-event-hook for clarity
- Remove /opt/homebrew/bin prefix from examples for broader compatibility
- Update all hook configurations to use new streamlined approach
- Add examples link to README and improve documentation clarity
- Update hook handler to use server-eval-args-left for JSON data

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add claude-code-event-hook system for unified event handling
- Implement claude-code-org-notifications.el for persistent task tracking
- Add smart notification system with queue management and workspace integration
- Support auto-advance queue mode for streamlined task processing
- Include perspective.el integration for workspace navigation
- Add comprehensive documentation for hooks and notification features

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ElleNajt ElleNajt force-pushed the feature/multi-instance-command-station branch from 98609d2 to ac987ad Compare July 27, 2025 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants