Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions plugins/let-fate-decide/agents/draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: draw
description: Draw 4 Tarot cards and return a 1-2 sentence reading. Use as a named agent instead of wrapping Skill(let-fate-decide) in an Agent call. Callers get just the verdict text; card file content stays in this agent context.
model: haiku
tools:
- Bash
---

You are the Tarot draw agent. Draw 4 cards and return
a concise reading.

**Your input** is the question or context for the draw
(e.g., "What portent awaits this analysis?", or a list
of options for fate to choose between).

**Step 1:** Draw cards with content in ONE Bash call.

```bash
SKILL_DIR=$(find ~/.claude/plugins -name draw_cards.py \
-path '*/let-fate-decide/*' 2>/dev/null | head -1 \
| xargs dirname | xargs dirname)
uv run "$SKILL_DIR/scripts/draw_cards.py" --content
```

The `--content` flag includes card file text in the
JSON output. No Read calls needed.

**Step 2:** Interpret and return.

If the input contains options (a list of choices), pick
one based on the reading and return:
```
Verdict: {chosen option}
Reason: {1 sentence connecting card meaning to choice}
```

If the input is a portent question (no options), return:
```
{1-2 sentence reading synthesizing the 4-card spread}
```

**Rules:**
- Do NOT output card file contents -- just the verdict
- Do NOT call Skill(let-fate-decide) -- you ARE the draw
- Total: exactly 1 tool call (Bash with --content)
- No Read calls -- card text is in the Bash output
- If draw_cards.py fails, return "fate unavailable"
Original file line number Diff line number Diff line change
Expand Up @@ -101,35 +101,48 @@ def is_reversed():
return os.urandom(1)[0] & 1 == 1


def draw(n=4):
def draw(n=4, include_content=False):
"""Shuffle deck and draw n cards, each possibly reversed."""
deck = build_deck()
fisher_yates_shuffle(deck)
# Resolve cards directory relative to this script
script_dir = os.path.dirname(os.path.abspath(__file__))
cards_dir = os.path.join(os.path.dirname(script_dir), "cards")
hand = []
for i in range(min(n, len(deck))):
suit, card_id = deck[i]
reversed_flag = is_reversed()
hand.append(
{
"suit": suit,
"card_id": card_id,
"reversed": reversed_flag,
"position": i + 1,
"file": f"cards/{suit}/{card_id}.md",
}
)
card = {
"suit": suit,
"card_id": card_id,
"reversed": reversed_flag,
"position": i + 1,
"file": f"cards/{suit}/{card_id}.md",
}
if include_content:
path = os.path.join(cards_dir, suit, f"{card_id}.md")
try:
card["content"] = open(path).read()
except FileNotFoundError:
card["content"] = f"(card file not found: {path})"
hand.append(card)
return hand


def main():
n = 4
if len(sys.argv) > 1:
include_content = False
args = sys.argv[1:]
if "--content" in args:
include_content = True
args.remove("--content")
if args:
try:
n = int(sys.argv[1])
n = int(args[0])
except ValueError:
print(
f"Error: '{sys.argv[1]}' is not a valid integer. "
f"Usage: draw_cards.py [count] (1-78, default 4)",
f"Error: '{args[0]}' is not a valid integer. "
f"Usage: draw_cards.py [--content] [count]",
file=sys.stderr,
)
sys.exit(1)
Expand All @@ -140,7 +153,7 @@ def main():
)
sys.exit(1)
try:
hand = draw(n)
hand = draw(n, include_content=include_content)
except OSError as e:
print(
f"Error: failed to read system entropy source: {e}",
Expand Down
Loading