## Summary
Round 2 of pre-existing shellcheck cleanup. PR #349 (soc-j026) cleaned 6
files; the full pre-push gate's broader shellcheck step caught 3 more
pre-existing warnings on canonical post-#350.
Closes: soc-ruvk
Discovered-from: soc-j026
## Fixes
| File | Warning | Fix |
|---|---|---|
| `rpi-stream.sh:177` | SC2154 'p referenced but not assigned' inside
trap body | disable directive (`p` is the loop variable in the
single-quoted trap, not an outer reference) |
| `smoke-test-codex-skills.sh:125,141` | SC2088 tilde-in-quotes |
disable directives (intentional literal pattern match of the documented
path) |
| `cleanup-global-agents.sh:22` | SC2034 `LEAKED_DIRS` unused | convert
dead array to comment (script uses `ALLOWED_DIRS` whitelist; LEAKED_DIRS
was orphaned documentation) |
## Bundled sync
Includes `cp CHANGELOG.md docs/CHANGELOG.md` — same pre-existing sync
drift from PR #351 that PR #352 also fixes. Bundling lets this PR's gate
pass independently of #352's merge order. If #352 lands first, this
becomes a trivial conflict-resolve.
## Validation
- `shellcheck -S warning` clean on all 3 named files.
- `scripts/ship.sh` fast gate: PASSED.
- This is the same coherent-arc shape as PR #349 — different file set,
identical disposition (atomic, mechanical, no behavioral change).
Bounded-context: BC0-foundations (scripts)
Evidence: `shellcheck -S warning
scripts/{rpi-stream,smoke-test-codex-skills,cleanup-global-agents}.sh`
(clean)
Co-authored-by: Codex <codex@example.invalid>
Search ~/.agents/learnings/ and ~/.agents/patterns/ as global long-term
memory after local .agents/ directories. Global results receive a
configurable weight penalty (default 0.8) applied post-scoring so local
knowledge wins ties.
Key changes:
- config: GlobalLearningsDir, GlobalPatternsDir, GlobalWeight in PathsConfig
- resolver: GlobalDirs support for multi-tier file discovery
- inject_learnings/patterns: global collection with dedup via absolute paths
- inject_scoring: z-norm bypass for N<3 items (raw weighted scores)
- inject: atomicWriteFile for crash-safe JSONL mutation
- session-start.sh: mkdir global dirs on session start
- skills: learn --global/--promote, retro classification, inject/knowledge tiers
- scripts/cleanup-global-agents.sh: audit/archive leaked dirs from ~/.agents/
Post-mortem fixes included: typo, dead code removal, stat error logging,
promoted_to frontmatter support, find pipeline tolerance.