feat: implement git commit context tracing (ctx trace)#53
Merged
josealekhine merged 3 commits intomainfrom Apr 1, 2026
Merged
Conversation
Deploying ctx with
|
| Latest commit: |
8655f26
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://29840438.ctx-bhl.pages.dev |
| Branch Preview URL: | https://feature-commit-context-traci.ctx-bhl.pages.dev |
4eaf023 to
c9f07b1
Compare
c9f07b1 to
1be7979
Compare
Member
|
solid, well-structured feature. Murat clearly understands the codebase conventions. The PR is ready for merge with minor nits. What looks good
Some Nits That I will Address Separately (not merge blockers)
Verdict Good to merge. The feature is self-contained, well-tested, follows project conventions, and the docs are complete. The nits above are all minor — none are blockers. |
1be7979 to
ca744b7
Compare
Contributor
Author
|
/test |
Link every git commit back to the decisions, tasks, learnings, and sessions that motivated it. git log shows what changed, git blame shows who — ctx trace shows why. Embed context pointers in git commit trailers via a prepare-commit-msg hook. A new ctx trace command resolves those pointers back to the original reasoning. New CLI commands: - ctx trace [commit] show context for a specific commit - ctx trace --last N show recent commits with context - ctx trace --json machine-readable JSON output - ctx trace file <path> show context trail for a file - ctx trace tag <commit> manually tag a commit with --note - ctx trace hook enable install prepare-commit-msg hook - ctx trace hook disable remove the hook Three-source context detection: 1. Pending: refs accumulated from ctx add and ctx task complete 2. Staged: new entries detected in staged .context/ file diffs 3. Working state: in-progress tasks and CTX_SESSION_ID env var Storage: .context/state/pending-context.jsonl accumulated refs, cleared per commit .context/trace/history.jsonl permanent commit-to-context map .context/trace/overrides.jsonl manual tags from ctx trace tag Also fixes pre-existing lint issues surfaced by upgraded golangci-lint (gosec G703 path traversal nolint, staticcheck QF1012 Fprintf) and TestBinaryIntegration symlink resolution on macOS. Signed-off-by: Murat Parlakisik <parlakisik@gmail.com>
ca744b7 to
7c47af4
Compare
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Structural fixes applied to the commit context tracing feature (PR #53) and pre-existing code quality issues surfaced during review. cmd/core separation: - Extract Complete() from cmd/complete to core/complete - Extract initScratchpad, hasEssentialFiles, ensureGitignoreEntries, writeGettingStarted from initialize/cmd/root to core/ packages - Privatize RunAddSilent/RunCompleteSilent → addEntry/completeTask - Split private functions into own files per convention Safe I/O: - Replace os.WriteFile nolint:gosec with io.SafeWriteFile (18 sites) - Replace os.Open/os.ReadFile nolint:gosec with safe variants - Replace os.Stat nolint:gosec with io.SafeStat - Add io.SafeMkdirAll, io.SafeStat, io.SafeFprintf - Fix readErr shadowing in hook/cmd/root/run.go i18n pipeline alignment: - All trace cmd strings through assets/descriptors - All trace errors through err/trace package - All trace output through write/trace package - Hook scripts from Go const to embedded assets (hooks/trace/*.sh) - flagbind adoption: BoolFlag, BoolFlagP, IntFlagP, StringFlagPDefault - Magic numbers to config/trace constants - fmt.Fprintf buffer writes through io.SafeFprintf with warn sink Performance: - ShowLast uses includeTrailers=false (avoids N git subprocesses) Trace library cleanup: - All exec.Command("git",...) through internal/exec/git.Run - All magic strings to config constants - Private functions split to own files per convention - Proper doc.go blocks on all new packages Context files: - CLAUDE.md: deduplicate, align with golden template, fix heading - AGENTS.md: restore 3-line redirect (was 125 lines of GitNexus) - AGENT_PLAYBOOK.md: sync golden↔live, add supplementary files table, restore missing anti-patterns and validation checklist sections - Delete dead .context/PROMPT.md and assets/hooks/copilot-instructions.md - Restore .github/copilot-instructions.md Pre-existing fixes (own the branch): - gosec violations in parser/copilot, setup/agents, setup/copilot_cli - Dead ExtractIndex function removed from load_gate - Magic relay prefix strings in check_journal and check_ceremony 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.
Link every git commit back to the decisions, tasks, learnings, and sessions that motivated it. git log shows what changed, git blame shows who — ctx trace shows why.
Embed context pointers in git commit trailers via a prepare-commit-msg hook. A new ctx trace command resolves those pointers back to the original reasoning.
New CLI commands:
Three-source context detection:
Storage:
.context/state/pending-context.jsonl accumulated refs, cleared per commit
.context/trace/history.jsonl permanent commit-to-context map
.context/trace/overrides.jsonl manual tags from ctx trace tag