Skip to content

Commit 8bea6d8

Browse files
committed
chore: update docs and restore WIP changes
1 parent 5305dc0 commit 8bea6d8

7 files changed

Lines changed: 320 additions & 157 deletions

File tree

CLAUDE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ Commands are resolved in priority order:
8282
- `args`: Named positional arguments for template vars
8383
- `env` (object form): Sets process.env before execution
8484
- `$1`, `$2`, etc.: Map positional args to flags
85-
- `pre`/`before`: Command to run first, output prepended to prompt
86-
- `post`/`after`: Command to run after execution (receives MA_EXIT_CODE env var)
8785

8886
**All other keys** are passed directly as CLI flags:
8987

GUIDE.md

Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,321 @@ Output ONLY the raw bash script.
282282
# 2. We pipe the script to sh to execute the swarm immediately
283283
ma 10-architect.claude.md "Build a login page with a fastify backend" | sh
284284
```
285+
286+
---
287+
288+
# Part 2: The UX Tour
289+
290+
While Part 1 focused on power and complexity, Part 2 focuses on **User Experience (UX)**. These examples demonstrate features designed to make working with AI agents safe, interactive, and easy to understand for your team.
291+
292+
---
293+
294+
## 11. The Interactive Wizard
295+
296+
**Concept:** *Variable Recovery*
297+
**UX Problem:** You wrote a prompt with variables, but you don't want to memorize the argument order.
298+
**Solution:** If you forget to provide variables, `ma` detects them and turns the CLI into an interactive form.
299+
300+
**File:** `11-onboarding.claude.md`
301+
302+
```markdown
303+
---
304+
model: sonnet
305+
---
306+
Welcome to the team, {{ name }}!
307+
308+
Please generate a warm onboarding email for a new engineer joining the {{ department }} team.
309+
Mention that their manager is {{ manager }}.
310+
```
311+
312+
**Run it (without arguments):**
313+
314+
```bash
315+
ma 11-onboarding.claude.md
316+
```
317+
318+
**`ma` responds:**
319+
320+
```text
321+
Missing required variables. Please provide values:
322+
? name: Alice
323+
? department: Platform
324+
? manager: Bob
325+
```
326+
327+
*UX Benefit: Turns static scripts into interactive tools automatically.*
328+
329+
---
330+
331+
## 12. The Safety Net (Dry Run)
332+
333+
**Concept:** *Trust & Verification*
334+
**UX Problem:** You are about to run an agent on your entire codebase, but you're nervous about token costs or context size.
335+
**Solution:** Use `--dry-run` to see exactly what *would* happen—the command, the expanded files, and the token count—without executing anything.
336+
337+
**File:** `12-refactor.gemini.md`
338+
339+
```markdown
340+
---
341+
model: gemini-1.5-pro
342+
---
343+
Refactor every file in this directory:
344+
@./src/**/*.ts
345+
```
346+
347+
**Run it:**
348+
349+
```bash
350+
ma 12-refactor.gemini.md --dry-run
351+
```
352+
353+
**Output:**
354+
355+
```text
356+
DRY RUN - Command will NOT be executed
357+
Command: gemini --model gemini-1.5-pro ...
358+
Final Prompt: (Shows full expanded content of all files)
359+
Estimated tokens: ~15,420
360+
```
361+
362+
*UX Benefit: Verify expensive operations before spending money.*
363+
364+
---
365+
366+
## 13. The Native Binary
367+
368+
**Concept:** *Shebang Support*
369+
**UX Problem:** Typing `ma filename.md` feels like running a script. You want it to feel like a native system command.
370+
**Solution:** Add a standard Unix shebang line.
371+
372+
**File:** `daily-report` (no extension needed)
373+
374+
```markdown
375+
#!/usr/bin/env ma
376+
---
377+
command: claude
378+
model: haiku
379+
---
380+
Generate a "Daily Standup" update based on my git activity:
381+
!`git log --since="24 hours ago" --oneline`
382+
```
383+
384+
**Run it:**
385+
386+
```bash
387+
chmod +x daily-report
388+
./daily-report
389+
```
390+
391+
*UX Benefit: Abstracts away the tool entirely. It just behaves like a binary.*
392+
393+
---
394+
395+
## 14. The "Knobs & Dials" Interface
396+
397+
**Concept:** *Hijacked Configuration ($vars)*
398+
**UX Problem:** You want to expose configuration settings (defaults) that users can easily override via flags.
399+
**Solution:** Variables starting with `$` in the frontmatter define defaults that are "hijacked" (consumed) by the template system.
400+
401+
**File:** `14-translator.gpt.md`
402+
403+
```markdown
404+
---
405+
command: openai
406+
model: gpt-4o
407+
# Default configuration
408+
$lang: Spanish
409+
$tone: Professional
410+
---
411+
Translate the following text into {{ lang }}. Keep the tone {{ tone }}.
412+
413+
<text>
414+
{{ $1 }}
415+
</text>
416+
```
417+
418+
**Run it:**
419+
420+
```bash
421+
# Use defaults
422+
ma 14-translator.gpt.md "Hello World"
423+
424+
# Tweak the knobs via flags
425+
ma 14-translator.gpt.md "Hello World" --lang "Pirate" --tone "Aggressive"
426+
```
427+
428+
*UX Benefit: Creates a stable CLI interface for your prompts.*
429+
430+
---
431+
432+
## 15. The Context Surgeon
433+
434+
**Concept:** *Symbol Extraction*
435+
**UX Problem:** Importing entire files is wasteful and distracting when you only need one specific interface.
436+
**Solution:** Use the `#Symbol` syntax to extract specific code blocks (Functions, Classes, Interfaces).
437+
438+
**File:** `15-test-gen.claude.md`
439+
440+
```markdown
441+
---
442+
model: sonnet
443+
---
444+
Write a unit test for this specific function:
445+
446+
@./src/utils.ts#calculateTax
447+
448+
Ensure it returns a type matching:
449+
450+
@./src/types.ts#TaxResult
451+
```
452+
453+
*UX Benefit: Precision context reduces hallucinations and token costs.*
454+
455+
---
456+
457+
## 16. The "Context Pack"
458+
459+
**Concept:** *Recursive Imports*
460+
**UX Problem:** You constantly have to import the same 5 files (auth, database, types) for every task.
461+
**Solution:** Create a "Context Pack"—a markdown file that just imports other files—and import *that*.
462+
463+
**File:** `_context-auth.md`
464+
465+
```markdown
466+
# Auth System Context
467+
@./src/auth/session.ts
468+
@./src/auth/types.ts
469+
@./src/auth/login.ts
470+
```
471+
472+
**File:** `16-security-audit.claude.md`
473+
474+
```markdown
475+
---
476+
model: opus
477+
---
478+
Review the authentication flow for security holes.
479+
@./_context-auth.md
480+
```
481+
482+
*UX Benefit: Build a library of "mental models" that are easy to drop into any agent.*
483+
484+
---
485+
486+
## 17. The Secret Keeper
487+
488+
**Concept:** *Environment Isolation*
489+
**UX Problem:** You need API keys in your prompts but can't commit them to Git.
490+
**Solution:** `ma` automatically loads `.env` files from the markdown file's directory.
491+
492+
**Structure:**
493+
494+
```text
495+
/my-agents/
496+
├── .env (Contains: API_URL=https://api.staging.com)
497+
└── 17-api-check.claude.md
498+
```
499+
500+
**File:** `17-api-check.claude.md`
501+
502+
```markdown
503+
---
504+
model: sonnet
505+
---
506+
Write a curl command to check the health of:
507+
!`echo $API_URL`
508+
```
509+
510+
*UX Benefit: Safe, zero-config secret management that works with Git.*
511+
512+
---
513+
514+
## 18. The Chameleon (Polymorphism)
515+
516+
**Concept:** *Command Override*
517+
**UX Problem:** You want to A/B test a prompt against different models without creating multiple files.
518+
**Solution:** Override the inferred command using the `-c` flag.
519+
520+
**File:** `18-story.md` (No command in filename)
521+
522+
```markdown
523+
Write a two-sentence horror story about a compiler.
524+
```
525+
526+
**Run it:**
527+
528+
```bash
529+
# Test with Claude
530+
ma 18-story.md -c claude --model haiku
531+
532+
# Test with Gemini
533+
ma 18-story.md -c gemini --model gemini-1.5-flash
534+
```
535+
536+
*UX Benefit: Decouple your prompt logic from specific providers.*
537+
538+
---
539+
540+
## 19. The Black Box Recorder
541+
542+
**Concept:** *Structured Logging*
543+
**UX Problem:** An agent hallucinated or failed, and you need to see exactly what was sent to the API.
544+
**Solution:** `ma` logs every execution to `~/.markdown-agent/logs/`.
545+
546+
**File:** `19-mystery.claude.md`
547+
548+
```markdown
549+
---
550+
model: opus
551+
---
552+
(Some complex prompt with dynamic imports...)
553+
```
554+
555+
**Run it:**
556+
557+
```bash
558+
ma 19-mystery.claude.md
559+
```
560+
561+
**Debug it:**
562+
563+
```bash
564+
ma --logs
565+
# Agent logs:
566+
# /Users/me/.markdown-agent/logs/19-mystery-claude/
567+
```
568+
569+
*UX Benefit: Instant forensic debugging without cluttering your terminal.*
570+
571+
---
572+
573+
## 20. The "Meta" Agent
574+
575+
**Concept:** *Self-Replication*
576+
**UX Problem:** Creating new agents takes time.
577+
**Solution:** Use an agent to write your agents.
578+
579+
**File:** `20-agent-smith.claude.md`
580+
581+
```markdown
582+
---
583+
args: [goal]
584+
model: sonnet
585+
---
586+
I want to create a new markdown-agent file.
587+
Goal: {{ goal }}
588+
589+
Write the full content of a `.md` file that accomplishes this.
590+
Include appropriate frontmatter defaults (model, args).
591+
Use standard `ma` features like `@imports` if the goal implies reading code.
592+
593+
Output ONLY the raw markdown code block.
594+
```
595+
596+
**Run it:**
597+
598+
```bash
599+
ma 20-agent-smith.claude.md "Review my rust code" > review-rust.claude.md
600+
```
601+
602+
*UX Benefit: The tool helps you build the tool.*

instructions/CHECK_ACTIONS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
2-
pre: gh run list --limit 2
32
model: claude-haiku-4.5
43
silent: true
54
allow-tool:
65
- shell(gh run:*)
76
interactive: true
87
---
98

10-
Analyze the GitHub Actions output above. Tell me:
9+
Check GitHub Actions status. Tell me:
1110
1. Are there any failed runs? If so, what failed?
1211
2. What's the overall health of the CI pipeline?
1312
3. Any runs currently in progress?

instructions/CREATE_INSTRUCTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ Description of what this instructions file does.
6565

6666
## Reference files for patterns:
6767
- SETUP_NPM_PUBLISHING.md - Interactive setup with user prompts and browser opening
68-
- CHECK_ACTIONS.md - Using `pre:` to run commands and analyze output
68+
- CHECK_ACTIONS.md - Interactive CI status checking

instructions/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ DEMO.md
2121

2222
| Field | Type | Description |
2323
|-------|------|-------------|
24-
| `pre` | string | Command to run first, output prepended to prompt (alias: `before`) |
25-
| `post` | string | Command to run after execution (alias: `after`) |
2624
| `model` | enum | AI model (claude-haiku-4.5, claude-opus-4.5, gpt-5, etc.) |
2725
| `agent` | string | Custom agent name |
2826
| `silent` | bool | Only output response, no stats |

0 commit comments

Comments
 (0)