Skip to content

feat(flags): add the Code Mode flag - #794

Merged
dean0x merged 24 commits into
mainfrom
feat/code-mode-direct
Nov 24, 2026
Merged

dean0x merged 24 commits into
mainfrom
feat/code-mode-direct

Conversation

@dean0x

@dean0x dean0x commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

The Devflow proxy sets a base URL in user settings, so Claude Code's experimental Code Mode cannot start, and devflow has no switch for Code Mode. This PR adds a code-mode flag, off by default. With the flag on, new sessions use Code Mode and talk to Anthropic directly.

Changes

  • New flag code-mode (devflow flags --enable code-mode), off by default. With it on, new sessions use Code Mode and talk to Anthropic directly.
  • code-mode and the Devflow proxy refuse each other. Each enable stops and names the command that turns the other off.
  • Status, list and init show a warning when Code Mode cannot start (the proxy is on, or disable-nonessential-traffic is on).
  • A CLAUDE_CODE_EXPERIMENTAL_CODE_MODE value that the user set stays in place. Devflow removes only the value "1" that it writes.

Breaking Changes

None expected.

Known Limits

  • Two commands that run at the same time can both pass the check; the effect is only that Code Mode does not start.
  • Shell exports and project settings are not seen.
  • Other settings that stop Code Mode are documented, not checked.
  • devflow proxy --enable cannot repair drift while code-mode is on.
  • The per-session launcher is deferred.
  • The two live Claude Code checks through the proxy (TP-24, TP-35) did not run, because they need a real sign-in. Steps 1 to 7 of the check passed in a scratch home directory.

Testing

  • The full test suite passed at the head commit: 417 of 417 files.
  • Scenario QA passed for 48 of 50 test-plan lines.
  • Two test-plan lines, TP-24 and TP-35, are manual checks. They did not run. See Known Limits.

Related Issues

Closes #792

Keep Code Mode off by default. Adopt an unclaimed on value and
preserve other values unless the write explicitly turns the flag on.

Refs #792 (feat/code-mode-direct)
Move proxy URL classification into core. Give Code Mode one read-only
source for local signals, refusals and warnings. Keep the existing proxy
command interface.

Task: feat/code-mode-direct (phase 2)
Refs #792
Refuse off-to-on changes while the proxy is on. Show local blockers
after a successful write and in the flag tables without extra writes.

Refs #792
Task: feat/code-mode-direct
Refuse proxy enable before it writes or starts the relay when Code Mode is on.
Show the shared blocker warnings in proxy status without writes.

Refs #792
Task: feat/code-mode-direct
Use the final proxy state and flag record so init does not warn about a
proxy that failed preflight. Keep both settings when a conflict remains.

Task: feat/code-mode-direct
Refs #792
List the blockers and the user settings rules. Explain why Code Mode
and the Devflow proxy cannot run in the same session.

Task: feat/code-mode-direct
Refs: #792
Use the non-hoisted call so the cleanup runs after the test.

Task: feat/code-mode-direct
Check that CLI and TUI enables leave both files unchanged when Devflow cannot read the settings env.
Check that CLI re-enable succeeds with a warning when Code Mode and the proxy are both on.

Task: resolve-batch-a
Use the same settings limit for status and enable.

Task: resolve-batch-c
Explain why a file close error gives an unreadable result.

Task: resolve-batch-c
State which rules and hooks apply to each tool call.

Task: resolve-batch-c
Check that a file at a directory path does not count as absent.
Check the fixed proxy errors and the Code Mode message text.

Task: resolve-batch-b
@dean0x

dean0x commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Code Review — Cycle 1

Full summary withheld (public repository).

Category CRITICAL HIGH MEDIUM LOW Total
Blocking 0 1 1 - 2
Should Fix - 0 2 - 2
Pre-existing - - 0 0 0

Full report: .devflow/docs/reviews/feat-code-mode-direct/2026-11-19_0242/post-review-summary.md (not committed; ask the author)

Posted by devflow · cycle 1

@dean0x

dean0x commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Resolution Summary

Full summary withheld (public repository).

Metric Value
Total Issues 10
Fixed 7
False Positive 1
By Design 0
Deferred 0
Blocked 0
Escalated 0
Duplicates Collapsed 2

Full report: .devflow/docs/reviews/feat-code-mode-direct/2026-11-19_0242/resolution-summary.md (not committed; ask the author)

Posted by devflow

@dean0x

dean0x commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner Author

Test-plan evidence

Head: 4afd1e2

State Count
VERIFIED-CI 47
ATTESTED-LOCAL 1 (TP-34, docs check)
UNVERIFIED 2 (TP-24, TP-35)
STALE 0
FAILED 0
Total 50
  • TP-24 and TP-35 need a real start of claude with Code Mode on, with the proxy off and then on. They need a real sign-in, so they did not run. The maintainer decided to merge without them. The PR body lists them under Known Limits.
  • The 5 test points that went stale at this head ran again and passed (TP-3, TP-17, TP-20, TP-30, TP-34; 5 claims at 4afd1e2, CI run passing).
  • Full validation at 4afd1e2: build PASS, typecheck PASS, 417/417 test files PASS (20084 tests, 0 failed).
  • CI at 4afd1e2: PASSING (build-and-test, macos-bash32-hooks, security/snyk).
  • Three base updates merge main into this branch (dcc4a18, e117014, 4afd1e2). The first and the third had one conflict each, in CHANGELOG.md. The [Unreleased] section keeps the Code Mode entry and the entries from main.
Review, cycle 2 (security, testing, reliability)
  • Security: no findings.
  • Reliability: no blocking findings; three suggestions.
  • Testing: one blocking gap. No test showed that a write which does not turn Code Mode on still runs when the Code Mode check cannot read the settings.
Resolution, cycle 2
Outcome Count
Fixed 4
By design 2
False positive 0
Deferred 0
  • d2943fb: devflow flags reads the user settings.json through the bounded reader. It does not change a file that is over 1 MiB or is not valid UTF-8, and leaves it as it is. New rows show that a disable, an unrelated enable and an unrelated TUI save still run when the Code Mode check cannot read its signals. The read-failure message now tells the user to check the Claude Code user settings.json.
  • 6097b5c: a proxy state file whose root is not an object (for example [] or 5) now counts as unreadable, and so counts as the proxy being on. An object with a wrong-typed field keeps its default.
  • 3070d8b: direct tests for the shared reader: a handle that fails the open-time check, and a failed close, both give "unreadable".
  • d508c9c: one CHANGELOG sentence for the settings-file limit of devflow flags.
  • By design: the proxy module keeps its re-export of the proxy env reader, and the Code Mode check counts only the exact value that devflow writes as on. The plan states both.
  • Each new test has a recorded failing run before the fix.

This comment is edited in place when the head changes.

Test that the reader skips the read and closes the handle if it
exceeds the limit. Test that a failed close discards the bytes.

Task: resolve-b
Use the fixed parse error for non-object proxy state. Keep default
values for missing or invalid object fields.

Task: resolve-c
Leave both files unchanged if the flags command cannot read user settings.
Keep flag writes that do not turn Code Mode on independent of its signal check.
Point users to their Claude Code user settings when the check fails.

Task: resolve-a
@dean0x
dean0x merged commit c8282b1 into main Nov 24, 2026
3 checks passed
@dean0x
dean0x deleted the feat/code-mode-direct branch November 24, 2026 15:18
@dean0x dean0x mentioned this pull request Nov 24, 2026
dean0x added a commit that referenced this pull request Nov 24, 2026
## Summary

This PR sets the version to 3.21.0 and moves the `[Unreleased]` notes to
the 3.21.0 section. After the merge, a `v3.21.0` tag on the merge commit
starts the release workflow.

## Changes

- `package.json` and `package-lock.json`: version 3.20.0 to 3.21.0.
- `CHANGELOG.md`: new `## [3.21.0] - 2026-11-24` section, new empty
`[Unreleased]` section, and the 3.21.0 compare link.
- `CHANGELOG.md`: the `[Unreleased]` compare link now starts at
`v3.21.0`. It started at `v3.8.0` before.

## Shipped in 3.21.0

- #794: Code Mode flag (closes #792).
- #810: week forecast in the status line (closes #805).
- #811: working memory is opt-in, and the note has an 8 KB limit (closes
#807).
- #809: acceptance criteria under level 2 to 4 headings (closes #808).

## Breaking Changes

None. Working memory is off by default for new installs. Existing
installs keep their choice. `devflow memory --enable` turns it on.

## Testing

- `npm run build`: pass.
- `npm run test`: 417 files, 20084 passed, 8 skipped, 0 failed.
- `npm run test:integration`: 5 files, 55 passed.
- `npm run version:bump -- 3.21.0` a second time changes no file.
- The tests ran on the base commit c8282b1. This PR changes only the
version and the changelog.
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.

Add a code-mode flag for sessions that do not use the Devflow proxy

1 participant