Commit 7c01862
committed
feat: add Allman/BSD LISP formatting rules to AI system prompt
Added comprehensive formatting guidelines to teach AI proper code style:
✨ The One-Liner Rule:
- Same line close: (define x (+ 1 2)) → Keep inline
- Different line close: Opening ( MUST be alone on own line
📚 Documentation Added:
- Clear examples of correct vs incorrect formatting
- Vertical alignment benefits explained
- Indentation rules (2 spaces per level)
- Mixed style examples for common patterns
🎯 Why This Matters:
- AI-generated LISP is often unreadable one-liners
- Vertical alignment makes nesting depth obvious
- Easy to spot missing/extra parentheses
- Matches conventional LISP formatting (Scheme/Racket style)
✅ Verification:
Simple queries already follow the rule naturally:
```lisp
(define stats (get_block_stats)) ;; Closes same line ✅
(define slot (. stats currentSlot)) ;; Closes same line ✅
```
Complex nested code will now use Allman/BSD style when
opening and closing parens span multiple lines.
📁 Modified:
- src/services/ai_service.rs (system prompt)
- Added 67 lines of formatting documentation
Related: #code-style #lisp-formatting #readability #ai-generated-code1 parent 274cedb commit 7c01862
1 file changed
+69
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1170 | 1170 | | |
1171 | 1171 | | |
1172 | 1172 | | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
1173 | 1242 | | |
1174 | 1243 | | |
1175 | 1244 | | |
| |||
0 commit comments