Skip to content

Add sessions_enabled feature toggle#71

Open
karlovsek wants to merge 4 commits intoGWUDCAP:mainfrom
karlovsek:feat/sessions_enabled-on-off-switch
Open

Add sessions_enabled feature toggle#71
karlovsek wants to merge 4 commits intoGWUDCAP:mainfrom
karlovsek:feat/sessions_enabled-on-off-switch

Conversation

@karlovsek
Copy link

Add configurable toggle to enable/disable cc_sessions

Enable/disable all cc_sessions hooks except statusline. Provides early exit checks across all hook files and
exposes toggle through sessions config API commands.

Update statusline to show disabled state when sessions_enabled is false

When sessions_enabled feature flag is disabled, statusline now displays:

  • Simplified "cc-sessions disabled" message instead of mode/task info
  • Preserves context usage progress bar and git branch information
  • Hides Discussion/Implementation mode, tasks, and todo counts

Document sessions_enabled feature toggle

Added documentation for the sessions_enabled feature flag including command syntax, behavior when disabled, and use cases for toggling the framework on/off.

- Add Development Setup section with local installation instructions
- Add build commands for Python (python -m build) and JavaScript (npm pack)
- Add Testing section documenting manual testing workflow
- Remove references to non-existent files (scripts/prepare-release.py, check-version-sync.sh, install.sh)
- Clarify Related Documentation to reflect actual repository structure
- Update Update Detection System to remove references to non-existent scripts
Add configurable toggle to enable/disable all cc-sessions hooks except
statusline. Provides early exit checks across all hook files and
exposes toggle through sessions config API commands.
When sessions_enabled feature flag is disabled, statusline now displays:
- Simplified "cc-sessions disabled" message instead of mode/task info
- Preserves context usage progress bar and git branch information
- Hides Discussion/Implementation mode, tasks, and todo counts

Maintains feature parity between Python and JavaScript implementations.
Added documentation for the sessions_enabled feature flag including command syntax, behavior when disabled, and use cases for toggling the framework on/off.
@satoastshi
Copy link
Contributor

/sessions state mode off

@karlovsek
Copy link
Author

/sessions state mode off

Thanks. Obviously didn't know about this 😅.

Anyway, an idea from this PR, to add some status to the statusline when bypass mode is active?

Also, I think that documentation could be improved. Running /sessions help, /sessions state, ... is slow in CC.
I know those commands can be run directly from console as sessions/bin/sessions status, but if I'm not mistaken this is not documented?

@satoastshi
Copy link
Contributor

Yes - valid points across the board. Will do some inlining of your recommendations and credit you for what we include on next release!

@pySilver
Copy link

@satoastshi I've run in some issue with state mode off. Specifically I occasionally run multiple instances of claude code. I don't get crazy with it, I just may want Claude to explore something in background for me. So for example at instance 1 I am disabling cc-session so it can do whatever it wants. Then I spawn instance 2 and do my regular work. And the second session actually kills the state mode off; I quickly asked CC to find out who is guilty and it says there is a bug.

However I am not sure if thats a bug or it is designed behavior:

❯ The author of the cc-session said there is a working solution: `/sessions state mode off` inside claude code instance. I see it works. However I also see that sometimes         
  when I spawn additional instance of the claude it switches back for the first instance                                                                                           
                                                                                                                                                                                   
⏺ Read(sessions/hooks/session_start.py)                                                                                                                                            
  ⎿  Read 464 lines                                                                                                                                                                
                                                                                                                                                                                   
⏺ There's the bug. Look at session_start.py:258-262:                                                                                                                               
                                                                                                                                                                                   
  with edit_state() as s:                                                                                                                                                          
      s.flags.clear_flags()      # <-- THIS                                                                                                                                        
      s.todos.clear_active()                                                                                                                                                       
      restored = s.todos.restore_stashed()                                                                                                                                         
      STATE = s                                                                                                                                                                    
                                                                                                                                                                                   
  And clear_flags() in shared_state.py:445-449:                                                                                                                                    
                                                                                                                                                                                   
  def clear_flags(self) -> None:                                                                                                                                                   
      self.context_85 = False                                                                                                                                                      
      self.context_90 = False                                                                                                                                                      
      self.subagent = False                                                                                                                                                        
      self.bypass_mode = False    # <-- RESETS YOUR "off" STATE                                                                                                                    
                                                                                                                                                                                   
  What happens:                                                                                                                                                                    
                                                                                                                                                                                   
  1. Instance A: /sessions state mode off → sets flags.bypass_mode = True in sessions-state.json                                                                                   
  2. Instance B starts → SessionStart hook fires → clear_flags() → writes bypass_mode = False back to the same file                                                                
  3. Instance A's next tool call → sessions_enforce.py reads state → bypass_mode is now False → enforcement is back on                                                             
                                                                                                                                                                                   
  The problem is architectural: SessionStart unconditionally nukes all flags from the shared state file, including the one that another instance is relying on. The flag system is 
  global (one JSON file), but clear_flags() treats it as session-local.                                                                                                            
                                                                                                                                                                                   
  The CI=1 environment variable approach I mentioned earlier doesn't have this problem because it's per-process, never touches the shared state file, and can't be cleared by      
  another instance starting up.  

Claude says pretending to be some automated creature might be a better solution.

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.

3 participants