Skip to content

Feat/explicit context dir#70

Merged
josealekhine merged 2 commits intomainfrom
feat/explicit-context-dir
Apr 25, 2026
Merged

Feat/explicit context dir#70
josealekhine merged 2 commits intomainfrom
feat/explicit-context-dir

Conversation

@josealekhine
Copy link
Copy Markdown
Member

feat: enforce explicit CTX_DIR with single-source anchor resolution

Replaces directory walk-up with explicit declaration via CTX_DIR
(canonical-basename and absolute-path enforced). The anchor now
arrives through ctx activate / ctx deactivate shell hooks plus
per-tool channels; non-exempt commands refuse to run without it.
ContextChild and the implicit walk-up paths are removed; over
twenty command entry points migrated through rc.RequireContextDir.

Highlights:

  • New cli/activate, cli/deactivate, system/check-anchor-drift
      commands plus the shell-emit primitives in config/shell and
      write/activate.
  • rc.ContextDir and state.Dir tightened to (string, error) with
      ErrDirNotDeclared. Callers now gate on err, eliminating the
      filepath.Join("", rel) trap that wrote state files into CWD.
  • testutil/testctx package introduced. Declare wires CTX_DIR and
      HOME for hermetic tests, eliminating cross-package races on
      ~/.claude/settings.json under parallel go test ./...
  • Test isolation: fourteen test files now declare CTX_DIR and
      HOME so a developer shell with CTX_DIR exported no longer
      pollutes test runs. cli_test.go's withCtxEnv helper replaced
      with a single t.Setenv at the top of TestBinaryIntegration.
  • Block-dangerous-command subtree retired in favor of the
      block-dangerous-commands plural canonical naming.
  • examples/demo/ removed (superseded by docs runbooks).
  • .context/ updated end-to-end: agent playbook, conventions,
      decisions, learnings, glossary, architecture, plus four new
      steering files.

Replaces directory walk-up with explicit declaration via CTX_DIR
(canonical-basename and absolute-path enforced). The anchor now
arrives through ctx activate / ctx deactivate shell hooks plus
per-tool channels; non-exempt commands refuse to run without it.
ContextChild and the implicit walk-up paths are removed; over
twenty command entry points migrated through rc.RequireContextDir.

Highlights:

- New cli/activate, cli/deactivate, system/check-anchor-drift
  commands plus the shell-emit primitives in config/shell and
  write/activate.
- rc.ContextDir and state.Dir tightened to (string, error) with
  ErrDirNotDeclared. Callers now gate on err, eliminating the
  filepath.Join("", rel) trap that wrote state files into CWD.
- testutil/testctx package introduced. Declare wires CTX_DIR and
  HOME for hermetic tests, eliminating cross-package races on
  ~/.claude/settings.json under parallel go test ./...
- Test isolation: fourteen test files now declare CTX_DIR and
  HOME so a developer shell with CTX_DIR exported no longer
  pollutes test runs. cli_test.go's withCtxEnv helper replaced
  with a single t.Setenv at the top of TestBinaryIntegration.
- Block-dangerous-command subtree retired in favor of the
  block-dangerous-commands plural canonical naming.
- examples/demo/ removed (superseded by docs runbooks).
- .context/ updated end-to-end: agent playbook, conventions,
  decisions, learnings, glossary, architecture, plus four new
  steering files.

Spec: specs/single-source-context-anchor.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
@josealekhine josealekhine self-assigned this Apr 25, 2026
@josealekhine josealekhine requested a review from bilersan as a code owner April 25, 2026 08:52
@josealekhine josealekhine merged commit 86a0446 into main Apr 25, 2026
12 checks passed
@josealekhine josealekhine deleted the feat/explicit-context-dir branch April 25, 2026 08:56
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