Skip to content

Let the Expense Review assistant read the code to explain rules - #132

Merged
rmartinsen-ucd merged 3 commits into
mainfrom
rpm/assistant-github-code
Nov 25, 2026
Merged

rmartinsen-ucd merged 3 commits into
mainfrom
rpm/assistant-github-code

Conversation

@rmartinsen-ucd

@rmartinsen-ucd rmartinsen-ucd commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Expense Review assistant can now read the code in the public ucdavis/AD419 repository to explain the rules behind the data, such as why a row is excluded or how an SFN is derived. Its instructions are rewritten around that.

Changes

  • The assistant session opts in to CAES AI's read-only GitHub tools with McpServers: ["github"]
  • The instructions are rewritten, described below
  • New test that the session carries the opt-in
  • docs/expense-review-assistant.md has a new Reading the code section
  • UCDavis.CaesAi.AppSdk goes from 0.2.0-beta.1 to 0.2.0-beta.2

Before this ships

  • Every CAES AI instance ad419 points at needs CAES_AI_GITHUB_MCP_TOKEN set. Without it, CAES AI rejects session creation and the whole assistant reports that it is unavailable, not only the GitHub tools. The test instance was deployed with the token secret on 2026-11-18. Other instances have not been checked

The earlier blockers are cleared: ucdavis/caes-ai#23 is merged and deployed to the test instance, and UCDavis.CaesAi.AppSdk 0.2.0-beta.2 is published with McpServers. server/server.csproj now references it.

What the instructions now do

  • Say what AD419 is and what the page shows, including that the import pulls three extra months on either side of the cycle while the page covers only the cycle
  • State the audience: financial analysts who know the finance side and are not technical. No code, table names or tool names in answers
  • Tie the filters to the chart string and say how filters combine
  • Warn that setting filters replaces every filter, so adding to the current view means reading it first
  • Ask for the answer first, a dollar format, and whether a total covers included rows, excluded rows or both
  • Describe what Data Classification can and cannot change, so the assistant can send an analyst to the right tab
  • Start with the data for why questions. The exclusion reason is usually the answer, and the code is only needed for the rule behind it
  • Treat classifications as data, not code. The code explains the rules but not how a particular code is classified
  • Map each kind of question to the file that answers it. Search is the fallback, limited to file paths to keep results small
  • Give no links or file names unless the analyst asks for the source or wants to take something to the developers

Notes

  • The instructions are 8,905 characters against the CAES AI limit of 16,384
  • The assistant reads main, which can be slightly ahead of what is deployed. The instructions tell it so
  • The opening sentence describing AD419 and the SFN is new wording and worth a read by someone who knows the report

Testing

  • With the published 0.2.0-beta.2 SDK, the 37 assistant tests pass and CI is green
  • An earlier, shorter version of the instructions ran end to end against real OpenAI and real GitHub on a local CAES AI
  • The rewritten instructions have not run against a real model
  • Not checked on the deployed test instance

🤖 Generated with Claude Code

The assistant session opts in to CAES AI's read-only GitHub tools, and
the instructions are rewritten for financial analysts: start with the
data, treat classifications as data rather than code, open the file that
holds a rule directly, and say what Data Classification can change.

Does not compile until UCDavis.CaesAi.AppSdk ships McpServers and the
package version is bumped.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8af595cd-8e4f-4929-a00c-fc912dd56dc5
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@sprucely sprucely left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex suggested some changes to assistant instructions to cover some edge cases. Everything else looks good.

Say what separates grouped rows, keep the include state when narrowing
a view, limit the 531010 Hatch rule to UCPath, and stop promising that
a classification change will include a row.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@sprucely sprucely left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more suggested tweaks...

- Data Classification has six tabs. Financial Dept sets whether a department is AES, which makes its expenses eligible for the report. Natural Account, Activity, and Purpose each set whether a code is included in AD419. Fund assigns an SFN to an included fund, or Multiple when the fund does not map to a single SFN, or marks the fund Excluded. ERN sets whether an ERN code counts toward FTE.
- ERN classification affects FTE only. It never changes dollar amounts.
- Transactions on fund 13U02, or on an SFN 204 project that is on the cycle's project list, are included whatever their purpose is classified as.
- When a row is excluded or unclassified by financial department, fund, account, activity, or purpose, and the row has a code in that segment, tell the user they can change that in Data Classification and name the tab. A row with no code in a segment, such as an expense with no activity, shows as unclassified for it, and there is no code on the tab to change. Say so rather than sending the user to the tab.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Check that a code is editable before directing an analyst to its tab

Line 41 tells the assistant to recommend a tab whenever the expense has a code. The integration test covers fund F-DX, whose only expense belongs to an excluded department. The expense has a fund code, yet the Fund tab hides it. Qualify the recommendation by whether the code is eligible to appear, and explain the blocking department classification in this case.

- When a row is excluded or unclassified by financial department, fund, account, activity, or purpose, and the row has a code in that segment, tell the user they can change that in Data Classification and name the tab. A row with no code in a segment, such as an expense with no activity, shows as unclassified for it, and there is no code on the tab to change. Say so rather than sending the user to the tab.
- Exclusion by date, by an account that overlaps between AE and UCPath, by a UCPath expense on account 531010 on a Hatch fund, or by an SFN 204 project that is not on the project list comes from fixed rules. It cannot be changed in Data Classification. The 531010 rule applies to UCPath only. An AE expense on account 531010 and a Hatch fund is not excluded by it.
- A row with no SFN derived can sometimes be fixed on the Fund tab. The SFN comes from the fund's classification, and when the fund is Multiple it comes from the transaction's project. If the fund is unclassified, classifying it can resolve the SFN. A single SFN resolves it. Multiple resolves it only when the project maps to one SFN. If the fund is Multiple and the project does not resolve to a single SFN, Data Classification cannot fix it. Resolving the SFN includes the row only if no other exclusion reason applies, so do not promise that a change will include a row.
- Data Classification lists only codes that can still change the report. A code whose transactions are all excluded by a fixed rule, or by another code that is classified as excluded, does not appear there. A code still appears while another code on the same transactions is unclassified, so classifying it may not be enough to include the row. When the user cannot find a code on a tab, or asks why one is listed, read the rules for which codes appear before you answer.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Describe visibility using the rules for the specific tab

Line 44 says another excluded code hides a candidate when it excludes all of that candidate’s transactions. For example, a department can still appear when its only expense has an excluded activity. The department’s visibility depends on the SFN, account, and purpose, and the activity classification has no effect on it. Direct the assistant to use the eligibility rules for the tab before explaining why a code appears or is missing.

@rmartinsen-ucd
rmartinsen-ucd merged commit db50e21 into main Nov 25, 2026
5 checks passed
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.

2 participants