Skip to content

docs(disable): add disable env vars master implementation plan#362

Merged
quangdang46 merged 4 commits into
masterfrom
discuss/kill-switch
Jun 5, 2026
Merged

docs(disable): add disable env vars master implementation plan#362
quangdang46 merged 4 commits into
masterfrom
discuss/kill-switch

Conversation

@quangdang46
Copy link
Copy Markdown
Owner

Summary

Master implementation plan for centralizing jcode's scattered environment variable kill-switches into a unified JCODE_DISABLE_* system, inspired by oh-my-claudecode's 3-tier disable architecture.

Background

jcode currently has ~90 JCODE_* env vars scattered across env_overrides.rs and various source files — all are config overrides, not kill-switches. Only JCODE_DISABLE_BASE_TOOLS is a true kill-switch. There's no centralized registry, no caching, no master kill, and no consistent pattern.

Solution

Design follows oh-my-claudecode's 3-tier approach:

  1. Master kill: JCODE_DISABLE=1 disables everything
  2. Scoped disable: JCODE_DISABLE_HOOKS=1, JCODE_DISABLE_PLUGINS=1, etc.
  3. Selective skip lists: JCODE_DISABLE_HOOK=pre_tool_use,post_tool_use

New crate module crates/jcode-base/src/disable.rs with:

  • DisableFlag enum (11 variants)
  • DisableRegistry with LazyLock caching
  • JCODE_DISABLE_FEATURE=... for experiment flag skipping
  • Deprecation shims for old env var names
  • Integration points in hooks, plugins, agent turn loop, TUI

File

Full plan at .omo/plans/disable-env-master-plan.md (694 lines, 11 sections).

Next Steps

  • Review the plan
  • Phase 1 implementation: disable.rs module + env_overrides migration
  • Phase 2: Integrate with hooks, plugins, agent turn loop
  • Phase 3: Documentation, tests, and rollback plan

quangdang46 and others added 2 commits June 4, 2026 06:23
…v vars

Create a LazyLock<DisableRegistry> singleton in jcode-base/src/disable.rs
that caches all JCODE_DISABLE_* env vars at first access. Provides:

- DisableFlag enum (12 variants: All, Hooks, Plugins, Memory, Swarm,
  Ambient, Mcp, Compaction, Telemetry, Mermaid, DesktopAnimation, PowerInhibit)
- Master kill-switch: JCODE_DISABLE_ALL=1 disables all subsystems
- Selective skip lists: JCODE_DISABLE_HOOK, JCODE_DISABLE_TOOL, etc.
- Unified API: disabled(flag), hook_disabled(name), tool_disabled(name)

Migrations:
- env_overrides.rs: populates Config fields from DisableRegistry,
  keeps deprecated env var reads for backward compat with warnings
- telemetry.rs: checks DisableFlag::Telemetry before JCODE_NO_TELEMETRY
- power_inhibit.rs: checks both legacy env var and DisableFlag::PowerInhibit
- animation.rs: checks DisableFlag::DesktopAnimation before JCODE_DESKTOP_REDUCED_MOTION
- config_file.rs: early init of DisableRegistry at Config::load()

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@quangdang46 quangdang46 marked this pull request as ready for review June 5, 2026 05:16
quangdang46 and others added 2 commits June 5, 2026 13:11
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Fix JCODE_DISABLE_BASE_TOOLS=false backward compat regression:
  deprecated env var now assigns parsed boolean directly instead of
  only upgrading to true, so =false correctly re-enables base tools.

- Cache JCODE_DISABLE_BASE_TOOLS in DisableRegistry at init time
  instead of reading env var on every base_tools_disabled() call,
  consistent with the load-once principle used by all other flags.
@quangdang46 quangdang46 merged commit 78995c2 into master Jun 5, 2026
4 of 9 checks passed
@quangdang46 quangdang46 deleted the discuss/kill-switch branch June 5, 2026 18:14
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.

1 participant