Commit 58b1c0f
committed
feat: ctxctl module, OS-native memory pressure, typed audit errors
Branch wrap-up commit for feat/pad-undo-snapshot (pad-undo Phase 1
shipped earlier on this branch). It bundles several arcs developed
together under the "we own the branch, one commit" plan, plus a few
unrelated items captured at the user's request. Grouped by area, with
the spec each serves.
ctxctl: separate maintainer module (per specs/ctxctl-bootstrap.md)
The out-of-band audit channel leaves the shipped `ctx` binary
entirely. Six logic trees (cli/audit, system/cmd/checkaudit,
system/core/audit, config/audit, err/audit, write/audit) were
relocated under internal/ctxctl/... with imports rewritten. A new
separate Go module lives at tools/ctxctl/ (module path
github.com/ActiveMemory/ctx/tools/ctxctl; its go.mod requires the
ctx module via `replace ../..`; the repo-root go.work links both),
so the ctx module never requires ctxctl and can never import it.
tools/ctxctl wires `ctxctl audit list|show|dismiss` plus the
`ctxctl audit-relay` hook (renamed from check-audit). The audit
channel's English lives as plain Go constants under tools/ctxctl
(no YAML i18n, no desc engine); the ctx-side audit YAML keys and
DescKey* constants were deleted. The Makefile gains ctxctl,
install-ctxctl and reinstall-ctxctl. An import-graph guard
(internal/compliance/ctxctl_isolation_test.go) asserts cmd/ctx
depends on no internal/ctxctl/... package and that the shipped
hooks.json carries no check-audit. The repo-local UserPromptSubmit
hook invokes `ctxctl audit-relay`.
Typed audit errors (per specs/ctxctl-bootstrap.md)
internal/ctxctl/err/audit now returns typed, text-free errors
(ReadReportError, ParseReportError, WriteDismissalError,
ReadDismissalError, UnknownIDError, plus the ErrIDRequired,
ErrNoFrontmatter and ErrUnterminatedFrontmatter sentinels). The
user-facing English moved to tools/ctxctl, which renders the errors
at the command edge through a sole printer (SilenceErrors on the
root, mirroring ctx's internal/write/err.With). This closes the one
place ctxctl text still lived in internal/, bringing the code into
full alignment with the spec.
OS-native memory pressure (correctness fix; no dedicated spec, see
DECISIONS.md 2026-05-27)
Replaces the broken occupancy-percentage DANGER triggers
(swap_used/total, memory_used/total) with the kernel's own pressure
signal. macOS reads kern.memorystatus_vm_pressure_level; Linux
parses /proc/pressure/memory PSI (some.avg10 >= 10 -> Warning,
full.avg10 >= 10 -> Danger); other platforms report
PressureSupported=false. The dead, always-OK doctor swap row and its
orphaned constants are removed. PSI thresholds are named in
config/stats for one-place retuning.
check-anchor-drift cleanup (per specs/experiments/acdl-session-start.md)
Primary-source archaeology proved check-anchor-drift was a
deliberately-retired feature (deleted in fc7db22), not a phantom;
its stale commands.yaml row is pruned. Follow-up tasks were filed:
plugin hooks.json version-skew fix, `ctx system` unknown-subcommand
verbatim relay, and Windows memory-pressure exploration.
Docs
docs/recipes/audit-channel.md and the recipes index reframe the
channel as maintainer-only via ctxctl with a repo-local hook; a new
"Maintainer Tooling: ctxctl" section in docs/home/contributing.md
documents build and install (make ctxctl / install-ctxctl /
reinstall-ctxctl). The rendered docs site (site/**) and feed were
regenerated.
Specs added
specs/ctx-add-json-ingest.md (design for `ctx <add> --json` ingest,
parked) and specs/experiments/acdl-session-start.md.
Tooling and context (dogfooding; unrelated items bundled per request)
.gitignore un-ignores go.work/go.work.sum (now tracked for the
workspace) and ignores the built ctxctl binaries (/ctxctl,
tools/ctxctl/ctxctl). CLAUDE.md and AGENTS.md gain a GitNexus
code-intelligence section. TASKS, DECISIONS, LEARNINGS and
CONVENTIONS were updated.
Verification: both modules pass `make lint` (0 issues) and `make test`
(green); `go build` is clean on each.
Spec: specs/ctxctl-bootstrap.md
Spec: specs/experiments/acdl-session-start.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>1 parent b9ce72e commit 58b1c0f
126 files changed
Lines changed: 4944 additions & 1198 deletions
File tree
- .claude/skills/_ctx-surface-audit
- .context
- docs
- home
- recipes
- internal
- assets
- commands
- text
- hooks/messages
- check-audit
- integrations/copilot-cli/skills
- ctx-architecture
- ctx-pad
- audit
- bootstrap
- cli
- audit/cmd/dismiss
- doctor
- core/check
- system
- compliance
- config
- doctor
- embed
- cmd
- flag
- text
- hook
- stats
- sysinfo
- ctxctl
- cli
- audit
- cmd
- dismiss
- list
- show
- core
- parse
- store
- checkaudit
- config/audit
- core/audit
- err/audit
- write/audit
- err/audit
- sysinfo
- write/audit
- site
- cli
- home
- contributing
- getting-started
- operations/runbooks/architecture-exploration
- recipes
- architecture-deep-dive
- audit-channel
- multi-tool-setup
- scratchpad-with-claude
- reference/skills
- specs
- experiments
- tools/ctxctl
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
11 | 24 | | |
12 | 25 | | |
13 | 26 | | |
| |||
165 | 178 | | |
166 | 179 | | |
167 | 180 | | |
168 | | - | |
| 181 | + | |
169 | 182 | | |
170 | 183 | | |
171 | 184 | | |
| |||
189 | 202 | | |
190 | 203 | | |
191 | 204 | | |
192 | | - | |
| 205 | + | |
193 | 206 | | |
194 | 207 | | |
195 | 208 | | |
| |||
213 | 226 | | |
214 | 227 | | |
215 | 228 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
220 | 233 | | |
221 | 234 | | |
222 | 235 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
157 | 202 | | |
158 | 203 | | |
159 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
165 | 198 | | |
166 | 199 | | |
167 | 200 | | |
| |||
0 commit comments