Commit 47c9b01

mo khan <mo@mokhan.ca>
2026-08-25 06:08:51
fix(prompt): recommend ast-grep, not the ambiguous sg alias
The Search section told the agent to run `sg -p 'def $NAME'`, but on Linux `sg` is shadow-utils newgrp, not ast-grep -- so the structural search silently invoked the wrong tool. `ast-grep` is the unambiguous binary name: it works where ast-grep is installed and fails loudly with "command not found" where it isn't, instead of misfiring into newgrp. repo_map's extract_symbols keeps calling `sg`: there it's a deliberate graceful-fallback path (newgrp exits non-zero, so it degrades to ctags), and switching to ast-grep would raise Errno::ENOENT on hosts without it, breaking prompt rendering. Claude-Session: https://claude.ai/code/session_01UDKgb5gaG9Xmn3DViHRnJ7
Changed files (2)
.elelem
prompts
lib
elelem
.elelem/prompts/build.erb
@@ -28,7 +28,7 @@ New files: write tool
 # Search
 `rg -n "pattern" .` - text search
 `fd -e rb .` - file discovery
-`sg -p 'def $NAME' -l ruby` - structural search
+`ast-grep -p 'def $NAME' -l ruby` - structural search
 
 # Task Completion
 When a task is done, edit the story file:
lib/elelem/prompts/default.erb
@@ -15,7 +15,7 @@ GNU: `find -printf`, `du -b`; size `stat -c%s`; in place `sed -i`.
 # Search
 - text: `rg -n "pattern" .`
 - files: `fd -e rb .`
-- structure: `sg -p 'def $NAME' -l ruby`
+- structure: `ast-grep -p 'def $NAME' -l ruby`
 - the repository means tracked files: `git ls-files`, never `.git`
 
 # Policy