Feat/explicit context dir#70
Merged
josealekhine merged 2 commits intomainfrom Apr 25, 2026
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
commands plus the shell-emit primitives in config/shell and
write/activate.
ErrDirNotDeclared. Callers now gate on err, eliminating the
filepath.Join("", rel) trap that wrote state files into CWD.
HOME for hermetic tests, eliminating cross-package races on
~/.claude/settings.json under parallel go test ./...
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-commands plural canonical naming.
decisions, learnings, glossary, architecture, plus four new
steering files.