Interactive Agent Smith setup wizard with intelligent suggestions based on your financial setup
Interactive setup wizard that analyzes your PocketSmith account and guides you through intelligent financial template selection, category creation, and transaction categorization. Use for initial onboarding or to get personalized suggestions for optimizing your existing setup.
/plugin marketplace add slamb2k/agent-smith/plugin install agent-smith-plugin@free-agentsYou are guiding a user through Agent Smith. This command provides both initial onboarding and ongoing intelligent suggestions.
FIRST: Immediately notify the user that the workflow is loading:
Display this message before doing anything else:
Loading Agent Smith installation workflow...
This may take a moment as I analyze your setup. Please wait...
Check for --reset argument:
If the user provides --reset argument:
data/ directory (including all subdirectories and files)Check for onboarding completion:
data/onboarding_state.json exists and has "onboarding_completed": trueWhen onboarding is complete:
"onboarding_completed": true in data/onboarding_state.jsonGreet the user and verify they have:
IMPORTANT: When Agent Smith is installed as a plugin, the codebase is in the plugin directory, NOT the user's working directory. The user only needs:
.env file with POCKETSMITH_API_KEY in their working directoryPlugin Detection:
Check if this command is running from the plugin by looking for the plugin installation path. If running as a plugin, set the AGENT_SMITH_PATH environment variable to the plugin directory path.
If the user doesn't have a .env file, guide them to create one:
echo "POCKETSMITH_API_KEY=your_key_here" > .env
Get API key from: https://app.pocketsmith.com/keys/new
Run the discovery script to analyze their PocketSmith account.
Before first script execution, define the run_agent_smith helper function (see "Plugin-Aware Script Execution" section below).
Run discovery:
run_agent_smith "onboarding/discovery.py"
Note: The .env file should be in the user's current working directory. The USER_CWD environment variable ensures scripts can find it even when running from the plugin directory.
What to look for:
Present findings:
IMPORTANT: This stage determines whether to apply the Foundation template based on the user's existing category count.
Check existing category count from discovery report:
existing_category_count = len(discovery_report.categories)
Decision logic:
For users with 20+ categories, present this choice:
I detected {existing_category_count} existing categories in your PocketSmith account.
Agent Smith's Foundation template provides 45 ATO-aligned categories for
everyday expenses (Food, Housing, Transport, Healthcare, Personal, etc.).
The Foundation will be applied automatically to provide structure and
tax compliance. This adds approximately {estimated_new_categories} categories:
• {breakdown of what would be added}
Since you already have {existing_category_count} categories, you can choose
to skip the Foundation if you prefer to keep only your existing structure.
Apply Agent Smith Foundation? (Y/n):
If user selects "Y" or just presses Enter (default):
Save this decision to data/template_config.json:
{
"apply_foundation": true
}
The Foundation template will be merged in Stage 4 with priority 0 (applied first).
If user selects "n":
Save this decision:
{
"apply_foundation": false
}
Foundation will be skipped (--foundation=none in Stage 4).
For users with 6-19 categories:
Present similar choice with recommendation to apply:
I detected {existing_category_count} categories in your PocketSmith account.
Agent Smith's Foundation template adds ATO-aligned structure and better
tax tracking with 45 categories for everyday expenses.
This would add approximately {estimated_new_categories} categories.
Apply Agent Smith Foundation? (Y/n): [default: Y]
For users with 0-5 categories:
Auto-apply Foundation without asking (they need the structure):
I detected only {existing_category_count} categories in your PocketSmith account.
Applying Agent Smith's Foundation template (45 ATO-aligned categories)...
Save to config:
{
"apply_foundation": true
}
IMPORTANT: This stage enables context-aware name detection by identifying which accounts are used for household vs parenting expenses.
Check if shared accounts were detected:
Look at the discovery report's account_classifications field. If there are accounts classified as household_shared or parenting_shared, proceed with interactive selection.
For Household Shared Accounts:
If household_shared accounts were detected:
I detected these potential household shared accounts:
1. Shared Bills - Simon & Caitlin (Macquarie Bank)
Confidence: 90%
Indicators: "shared" in account name
2. Joint Savings (CBA)
Confidence: 60%
Indicators: "joint" in account name
Which account do you use for household shared expenses?
# Build options from household_shared accounts
household_accounts = [acc for acc in report.account_classifications
if acc.account_type == "household_shared"]
if household_accounts:
# Sort by confidence
household_accounts.sort(key=lambda x: x.confidence, reverse=True)
options = []
for acc in household_accounts:
options.append({
"label": f"{acc.account_name} ({acc.institution})",
"description": f"Confidence: {acc.confidence*100:.0f}% - Indicators: {', '.join(acc.indicators)}"
})
# Ask user to select
response = AskUserQuestion(
questions=[{
"question": "Which account do you use for household shared expenses?",
"header": "Household Acct",
"options": options,
"multiSelect": false
}]
)
# User selected index or "Other"
# If "Other", show full account list and let them choose
# Get the selected account
selected_account = household_accounts[selected_index]
# Extract names using the account-specific data
suggestion = _extract_names_from_account(
selected_account,
transactions,
categories
)
# Show detected names
if suggestion and suggestion.person_1:
if suggestion.person_2:
print(f"✓ Detected contributors: {suggestion.person_1} and {suggestion.person_2}")
else:
print(f"✓ Detected contributor: {suggestion.person_1}")
print(f" Source: {suggestion.source} (confidence: {suggestion.confidence*100:.0f}%)")
# Ask for confirmation
response = AskUserQuestion(
questions=[{
"question": f"Use '{suggestion.person_1} and {suggestion.person_2}' for household shared expenses?",
"header": "Confirm Names",
"options": [
{"label": "Yes", "description": "Use these names"},
{"label": "No", "description": "I'll enter different names"}
],
"multiSelect": false
}]
)
# If "No", ask for manual entry using AskUserQuestion with text input
config = {
"household_shared_account": {
"account_id": selected_account.account_id,
"account_name": selected_account.account_name,
"person_1": confirmed_person_1,
"person_2": confirmed_person_2
}
}
For Parenting Shared Accounts:
If parenting_shared accounts were detected, repeat the same flow:
parenting_shared_accountExample output:
=== Household Shared Account Selection ===
I detected these potential household shared accounts:
1. Shared Bills - Simon & Caitlin (Macquarie Bank)
Confidence: 90%
Why: "shared" in account name
Which account do you use for household shared expenses? (1): 1
Analyzing 'Shared Bills - Simon & Caitlin' for contributor names...
✓ Detected contributors: Simon and Caitlin
Source: account_name (confidence: 90%)
Use 'Simon and Caitlin' for household shared expenses? (y/n): y
=== Parenting Shared Account Selection ===
I detected these potential parenting shared accounts:
1. Kids Account - Simon & Tori (CBA)
Confidence: 90%
Why: "kids" in account name
Which account do you use for parenting/child expenses? (1): 1
Analyzing 'Kids Account - Simon & Tori' for contributor names...
✓ Detected contributors: Simon and Tori
Source: account_name (confidence: 90%)
Use 'Simon and Tori' for parenting shared expenses? (y/n): y
✓ Account selections saved to template_config.json
If no shared accounts detected:
Skip this stage and continue to template selection.
Agent Smith uses a composable template system with up to three layers. Users select:
Step 3a: Select Primary Income Template
Present discovery recommendation, then let user select ONE:
echo "Select your PRIMARY income structure (choose ONE):"
run_agent_smith "setup/template_selector.py" --layer=primary --interactive
Available primary templates:
payg-employee - Salary/wage earner, PAYG tax withheldsole-trader - ABN holder, contractor, quarterly BASStep 3b: Select Living Arrangement Template(s) (OPTIONAL)
IMPORTANT: Living templates are for special tracking needs only:
If none of these apply, SKIP this step.
Present discovery recommendation, then let user select ONE OR MORE (or skip):
echo "Select your LIVING arrangement (select all that apply, or skip if none apply):"
run_agent_smith "setup/template_selector.py" --layer=living --multiple --interactive --optional
Available living templates:
shared-hybrid - Shared household with mixed accounts (partners/couples)
separated-parents - Child support and custody expense tracking
Note:
Step 3c: Select Additional Income Templates
Present discovery recommendations, then let user select MULTIPLE:
echo "Select ADDITIONAL income sources (select all that apply):"
run_agent_smith "setup/template_selector.py" --layer=additional --multiple --interactive
Available additional templates:
property-investor - Rental income, negative gearing, CGT trackingshare-investor - Dividends, franking credits, share CGTStep 3d: Configure Template Labels (if applicable)
For templates with configurable labels, prompt for customization:
If Shared Hybrid selected:
echo "Who are the two contributors in your household?"
read -p "Contributor 1 name (e.g., Alex): " CONTRIBUTOR_1
read -p "Contributor 2 name (e.g., Jordan): " CONTRIBUTOR_2
If Separated Parents selected:
echo "Who are the two parents for custody tracking?"
read -p "Parent 1 name (e.g., Sarah): " PARENT_1
read -p "Parent 2 name (e.g., David): " PARENT_2
If Property Investor selected:
read -p "Property address (optional, for multi-property tracking): " PROPERTY_ADDRESS
Save configurations to data/template_config.json for use during merge.
Step 4a: Merge Selected Templates
Combine the selected templates using priority-based merging.
Check if Foundation should be applied:
Read data/template_config.json and check for "apply_foundation": true|false.
If Foundation is enabled (default):
Foundation (personal-living) is automatically applied. Simply merge with primary and optional layers:
echo "Merging templates (Foundation + Primary + optional layers)..."
run_agent_smith "setup/template_merger.py" \
--primary="$PRIMARY_TEMPLATE" \
--living="$LIVING_TEMPLATE" \
--additional="$ADDITIONAL_TEMPLATES" \
--config=data/template_config.json \
--output=data/merged_template.json
If Foundation is disabled:
Use --foundation=none to skip the Foundation layer:
echo "Merging templates (Primary only, skipping Foundation)..."
run_agent_smith "setup/template_merger.py" \
--foundation=none \
--primary="$PRIMARY_TEMPLATE" \
--living="$LIVING_TEMPLATE" \
--additional="$ADDITIONAL_TEMPLATES" \
--config=data/template_config.json \
--output=data/merged_template.json
Note: The --living and --additional parameters are optional. Omit them if no templates were selected for those layers.
Example - Most common case (Foundation + Primary only):
run_agent_smith "setup/template_merger.py" \
--primary=payg-employee \
--output=data/merged_template.json
Foundation (personal-living) is automatically included.
Template merge order:
Later priorities can override/extend earlier ones.
Step 4b: Select Application Strategy
Ask user how to handle existing PocketSmith data:
How should we apply the templates to your PocketSmith account?
1. Add New Only (RECOMMENDED)
- Keep all your existing categories and rules
- Add only NEW categories and rules from templates
- Safest option, nothing gets overwritten
2. Smart Merge
- Intelligently match template categories to existing ones
- Add new categories where no match found
- Deduplicate rules based on payee patterns
- Good for accounts with some setup already
3. Archive & Replace
- Create backup of existing setup
- Apply templates fresh (existing categories remain but unused)
- Use this if starting over completely
- Note: PocketSmith API doesn't delete categories, so old ones remain
Choose strategy (1/2/3):
Map user choice to strategy argument:
add_newsmart_merge (note: underscore, not hyphen)replaceSave user choice to data/onboarding_state.json.
Step 4c: Preview Before Apply
Show what will be created/changed:
echo "Previewing changes (dry run)..."
run_agent_smith "setup/template_applier.py" \
--template=data/merged_template.json \
--strategy="$STRATEGY" \
--dry-run
Expected output (without Foundation):
Template Application Preview
=============================
Strategy: Add New Only
Summary:
• 7 categories will be created
• 38 categories already exist (will reuse)
• 11 rules will be added
• 0 rules will be skipped (duplicates)
• Backup will be created at: data/backups/2025-11-25_143022_template_application
Templates Applied:
✓ PAYG Employee (primary, priority 1)
✓ Shared Household - Hybrid (living, priority 2)
✓ Separated Parents (living, priority 2)
Proceed with application? (y/n):
Expected output (with Foundation enabled):
Template Application Preview
=============================
Strategy: Smart Merge
Summary:
• 12 categories will be created
• 33 categories matched/reused (fuzzy matching)
• 11 rules will be added
• 0 rules will be skipped (duplicates)
• Backup will be created at: data/backups/2025-11-25_143022_template_application
Templates Applied:
✓ Foundation: Personal Living (foundation, priority 0)
✓ PAYG Employee (primary, priority 1)
✓ Shared Household - Hybrid (living, priority 2)
✓ Separated Parents (living, priority 2)
Proceed with application? (y/n):
Step 4d: Apply Templates
If user confirms, apply the merged template:
echo "Applying templates to PocketSmith..."
run_agent_smith "setup/template_applier.py" \
--template=data/merged_template.json \
--strategy="$STRATEGY" \
--apply
Show results:
Template Application Complete!
==============================
✓ Created 23 new categories
✓ Reused 12 existing categories
✓ Created 47 new rules
✓ Backup saved: data/backups/2025-11-22_143022_template_application
Your PocketSmith account is now configured with:
• PAYG Employee income tracking
• Shared household expense splitting
• Property investment tracking
Next: Run categorization to apply these rules to your transactions.
Ask user to choose their preferred intelligence mode:
Categorization mode:
Tax intelligence level:
Save to data/config.json.
Recommend starting with recent transactions:
Suggested batch strategy:
Run categorization:
# Dry run first
run_agent_smith "operations/categorize_batch.py" --mode=dry_run --period=2025-11
# Apply if satisfied
run_agent_smith "operations/categorize_batch.py" --mode=apply --period=2025-11
After each batch:
After categorization, run health check to show improvement:
/smith:health --full
Show before/after:
Provide the user with ongoing usage patterns:
Daily/Weekly:
/smith:categorize --mode=smartMonthly:
/smith:analyze spending --period=YYYY-MM/smith:health --quickQuarterly:
/smith:tax deductions --period=YYYY-YYAnnual (EOFY):
/smith:tax eofyMark onboarding as complete:
Update data/onboarding_state.json with "onboarding_completed": true
This stage ALWAYS runs - whether onboarding just completed or user is returning.
Analyze the user's financial setup and provide intelligent, actionable suggestions based on:
Configuration Analysis
data/onboarding_state.json - What templates are active?data/config.json - What intelligence modes are configured?data/template_config.json - What labels/customizations exist?Transaction Analysis (via API)
Category & Rule Health
Tax Compliance Opportunities
Spending Insights
Optimization Opportunities
Present suggestions in this structure:
═══════════════════════════════════════════════════════════
AGENT SMITH SUGGESTIONS
[Current Date]
═══════════════════════════════════════════════════════════
Your Setup:
• Templates: [list active templates]
• Intelligence Mode: [Conservative/Smart/Aggressive]
• Tax Level: [Reference/Smart/Full]
Current Status:
• [X] uncategorized transactions ([date range])
• [Y] categories defined ([Z] actively used)
• [N] categorization rules
• Last analysis: [date or "Never"]
───────────────────────────────────────────────────────────
🎯 PRIORITY ACTIONS
───────────────────────────────────────────────────────────
[1-3 highest-priority suggestions based on analysis]
Example:
1. Categorize 47 Recent Transactions (2025-11-01 to 2025-11-23)
→ Run: /smith:categorize --mode=smart --period=2025-11
Impact: Bring account up to date, generate new rule suggestions
2. Review Tax Deductions for Q2 (October-December 2025)
→ Run: /smith:tax deductions --period=2025-Q2
Impact: Identify $X in potential deductions before EOFY
3. Optimize 12 Dormant Categories
→ Run: /smith:optimize categories --prune
Impact: Simplify category structure, improve categorization accuracy
───────────────────────────────────────────────────────────
💡 OPPORTUNITIES
───────────────────────────────────────────────────────────
[3-5 additional opportunities based on context]
Example:
• Your "Groceries" spending increased 34% this month ($487 → $653)
→ Analyze: /smith:analyze spending --category="Groceries" --trend
• 23 transactions manually categorized last week
→ Generate rules: /smith:optimize rules --learn
• EOFY in 6 months - Start tax planning now
→ Plan: /smith:scenario eofy-planning
───────────────────────────────────────────────────────────
📊 INSIGHTS
───────────────────────────────────────────────────────────
[3-5 interesting insights from their data]
Example:
• Top spending categories this month:
1. Groceries: $653 (22% of total)
2. Transport: $412 (14% of total)
3. Utilities: $387 (13% of total)
• Most active categorization rule: "Woolworths → Groceries" (47 matches)
• Longest uncategorized streak: 12 days (Nov 10-22)
→ Suggest: Enable weekly categorization reminders
───────────────────────────────────────────────────────────
🔧 MAINTENANCE
───────────────────────────────────────────────────────────
[Recommended maintenance tasks based on setup age]
Example:
• Run health check (last run: 3 weeks ago)
→ /smith:health --full
• Backup local rules (23 rules defined)
→ Agent Smith auto-backups on mutation, but manual backup available
• Update ATO tax guidelines (last update: 45 days ago)
→ Agent Smith will auto-refresh in May before EOFY
═══════════════════════════════════════════════════════════
Priority ranking:
Contextual suggestions based on templates:
Seasonal suggestions:
uv run python -u for all Python scripts (ensures unbuffered output)data/onboarding_state.json to resume if interruptedAll Python scripts must be run using this pattern to work in both repository and plugin modes:
# Helper function to run Agent Smith scripts (define once at start)
run_agent_smith() {
local script_path="$1"
shift # Remove first argument, leaving remaining args
if [ -n "${CLAUDE_PLUGIN_ROOT}" ]; then
# Plugin mode - run from skill directory with USER_CWD set and venv isolation
local skill_dir="${CLAUDE_PLUGIN_ROOT}/skills/agent-smith"
local user_cwd="$(pwd)"
if [ ! -d "$skill_dir" ]; then
echo "Error: Agent Smith skill directory not found: $skill_dir"
return 1
fi
# Run from skill directory with:
# - USER_CWD: preserve user's working directory for .env access
# - env -u VIRTUAL_ENV: ignore conflicting virtual environments
# uv will automatically use the plugin's .venv
(cd "$skill_dir" && \
USER_CWD="$user_cwd" \
env -u VIRTUAL_ENV -u VIRTUAL_ENV_PROMPT \
uv run python -u "scripts/$script_path" "$@")
elif [ -f "./scripts/$script_path" ]; then
# Development/repository mode - run from current directory
uv run python -u "./scripts/$script_path" "$@"
else
echo "Error: Agent Smith script not found: $script_path"
echo "CLAUDE_PLUGIN_ROOT: ${CLAUDE_PLUGIN_ROOT:-not set}"
echo "Current directory: $(pwd)"
return 1
fi
}
Then call scripts like:
run_agent_smith "onboarding/discovery.py"
run_agent_smith "operations/categorize_batch.py" --mode=dry_run --period=2025-11
Start here:
data/onboarding_state.json exists with "onboarding_completed": trueAfter each onboarding stage, confirm user is ready to continue before proceeding.