Skip to content

feat: core Prism tools — SpendingSummary, AccountBalances, Cashflow#7

Open
jordanpartridge wants to merge 6 commits into
masterfrom
feat/5-prism-tools
Open

feat: core Prism tools — SpendingSummary, AccountBalances, Cashflow#7
jordanpartridge wants to merge 6 commits into
masterfrom
feat/5-prism-tools

Conversation

@jordanpartridge
Copy link
Copy Markdown
Contributor

Summary

Adds the first three composable Prism tools. Each tool resolves its dependencies from the container, runs data through the privacy transformer, and returns a minimal CloudPayload JSON string the calling agent feeds directly into its next prompt.

  • GetSpendingSummaryTool — spending by category, filtered to non-pending transactions
  • GetAccountBalancesTool — current balances across all accounts, rounded to nearest $10 for cloud
  • GetCashflowTool — income vs expenses with category breakdown
  • FinanceTools::all() — registry to spread all tools into any Prism agent
  • ResolvePeriod trait — shared period resolution (current_month | last_month | last_30_days)

Also wires FinanceDataProvider binding into the service provider and adds PLAID_ACCESS_TOKEN to config.

Usage

// Any Prism agent
$agent->withTools(FinanceTools::all());

// Selective
$agent->withTools([
    GetSpendingSummaryTool::make(),
    GetCashflowTool::make(),
]);

Closes #5

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 5, 2026

🔧 Synapse Sentinel: 1 check need attention

The following issues must be resolved before this PR can be merged:


Test output could not be parsed:


  �[30;43;1m WARN �[39;49;22m Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!

   INFO  Test directory "/home/runner/work/finance/finance/tests/Feature" not found.


```---

**Quick Reference:**
- PHPStan errors → Fix type mismatches first, then missing types
- Test failures → Read the assertion message, trace expected vs actual
- Style issues → Run `composer format` to auto-fix


---
<sub>🤖 Generated by Synapse Sentinel - [View Run](https://github.com/the-shit/finance/actions)</sub>

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 5, 2026

🔧 Synapse Sentinel: 1 check need attention

The following issues must be resolved before this PR can be merged:


Test Failures (10 total)

Fix these failing tests:

1. it includes required body fields 0.01s

FAIL at Unknown file:?

⨯ it includes webhook when provided                                    0.01s  
  ⨯ it excludes webhook when null                                        0.01s  
  ⨯ it accepts custom products and country codes                         0.01s

Fix: Unexpected null value. Check for missing data or uninitialized variables.

2. it includes public token in body 0.01s

FAIL at Unknown file:?


Fix: Review the test expectation vs actual behavior. Check the tested code logic.

3. it includes access token in body 0.01s

FAIL at Unknown file:?


Fix: Review the test expectation vs actual behavior. Check the tested code logic.

4. it includes access token and default count in body 0.01s

FAIL at Unknown file:?

⨯ it includes cursor when provided                                     0.01s  
  ⨯ it accepts custom count                                              0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.

5. it calls ollama and returns reduced payload 0.01s

FAIL at Unknown file:?

⨯ it falls back to rule-stripped data when ollama returns invalid jso… 0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.

6. it paginates through all pages when has_more is true 0.01s

FAIL at Unknown file:?


Fix: Review the test expectation vs actual behavior. Check the tested code logic.

7. it all() returns three Tool instances 0.02s

FAIL at Unknown file:?

⨯ it spending() returns two Tool instances                             0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.

8. it returns a Tool instance with correct name 0.01s

FAIL at Unknown file:?

⨯ it returns json with rounded balances                                0.01s  
  ⨯ it handles null available balance                                    0.01s

Fix: Unexpected null value. Check for missing data or uninitialized variables.

9. it returns a Tool instance with correct name 0.01s

FAIL at Unknown file:?

⨯ it returns json from cloud payload                                   0.01s  
  ⨯ it uses last_month period correctly                                  0.01s  
  ⨯ it filters pending transactions                                      0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.

10. it returns a Tool instance with correct name 0.01s

FAIL at Unknown file:?

⨯ it filters pending transactions before sending to transformer        0.01s  
  ⨯ it returns json string from cloud payload                            0.01s  
  ⨯ it defaults to current_month when no period given                    0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.


Quick Reference:

  • PHPStan errors → Fix type mismatches first, then missing types
  • Test failures → Read the assertion message, trace expected vs actual
  • Style issues → Run composer format to auto-fix

🤖 Generated by Synapse Sentinel - View Run

Replace deprecated usingOllama() with using(Provider::Ollama, $model).
All 70 tests pass.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 5, 2026

🔧 Synapse Sentinel: 1 check need attention

The following issues must be resolved before this PR can be merged:


Test Failures (10 total)

Fix these failing tests:

1. it includes required body fields 0.01s

FAIL at Unknown file:?

⨯ it includes webhook when provided                                    0.01s  
  ⨯ it excludes webhook when null                                        0.01s  
  ⨯ it accepts custom products and country codes                         0.01s

Fix: Unexpected null value. Check for missing data or uninitialized variables.

2. it includes public token in body 0.01s

FAIL at Unknown file:?


Fix: Review the test expectation vs actual behavior. Check the tested code logic.

3. it includes access token in body 0.01s

FAIL at Unknown file:?


Fix: Review the test expectation vs actual behavior. Check the tested code logic.

4. it includes access token and default count in body 0.01s

FAIL at Unknown file:?

⨯ it includes cursor when provided                                     0.01s  
  ⨯ it accepts custom count                                              0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.

5. it calls ollama and returns reduced payload 0.01s

FAIL at Unknown file:?

⨯ it falls back to rule-stripped data when ollama returns invalid jso… 0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.

6. it paginates through all pages when has_more is true 0.01s

FAIL at Unknown file:?


Fix: Review the test expectation vs actual behavior. Check the tested code logic.

7. it all() returns three Tool instances 0.02s

FAIL at Unknown file:?

⨯ it spending() returns two Tool instances                             0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.

8. it returns a Tool instance with correct name 0.01s

FAIL at Unknown file:?

⨯ it returns json with rounded balances                                0.01s  
  ⨯ it handles null available balance                                    0.01s

Fix: Unexpected null value. Check for missing data or uninitialized variables.

9. it returns a Tool instance with correct name 0.01s

FAIL at Unknown file:?

⨯ it returns json from cloud payload                                   0.01s  
  ⨯ it uses last_month period correctly                                  0.01s  
  ⨯ it filters pending transactions                                      0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.

10. it returns a Tool instance with correct name 0.02s

FAIL at Unknown file:?

⨯ it filters pending transactions before sending to transformer        0.01s  
  ⨯ it returns json string from cloud payload                            0.01s  
  ⨯ it defaults to current_month when no period given                    0.01s

Fix: Review the test expectation vs actual behavior. Check the tested code logic.


Quick Reference:

  • PHPStan errors → Fix type mismatches first, then missing types
  • Test failures → Read the assertion message, trace expected vs actual
  • Style issues → Run composer format to auto-fix

🤖 Generated by Synapse Sentinel - View Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prism tools: reusable finance tools for any agent

1 participant