tres-cost-basis
Skill4.5k starsChanged 3 months agoApache-2.0View on GitHub
Manage cost basis calculation in TRES Finance: check status, view/change strategy (FIFO, LIFO, AVG, MAX_GAINS, MAX_LOSSES, FIFO_IMPAIRMENT), trigger recalculation, review financial issues, manage reevaluations/impairments, set bulk fiat prices, configure spec-ID lot disposal rules, view per-asset cost basis results, and export cost basis reports. Trigger this skill whenever the user asks about cost basis, gains/losses, realized gains, unrealized gains, COGS, inventory lots, tax lots, cost basis strategy, reevaluation, impairment, fiat value override, spec-ID rules, financial issues (negative balance, missing fiat), or anything related to how their crypto assets are costed. Also trigger when the user says "calculate cost basis", "what is my cost basis strategy", "show me financial issues", "create a reevaluation", "run cost basis", "change strategy to LIFO", or similar.
Trending
Quiet since October.about the whole repository
Who's talking about anthropics/claude-plugins-community
- @latreon.bsky.social“claude-plugins-community: Community plugin marketplace for Claude Cowork and Claude Code. It has picked up …”Bluesky · Aug 24, 2026 · 2 likes
- @yug1224.com“Claude Codeなどの機能拡張プラグインをまとめた公式コミュニティ向けのマーケットプレイスらしい 新しい拡張機能を色々探して試したい yug1224 starred …”Bluesky · Aug 24, 2026 · 1 likes
- @hackobar.bsky.social“3. Anthropic Community Plugin Marketplace for Claude Code and Cowork LINK 4. Daedalus-150M Hybrid …”Bluesky · Aug 24, 2026 · 1 likes
- sudosubin/agents.nix“claude-code-plugins.github.anthropics.claude-plugins-community: init at 0-unstable-2026-10-01”GitHub · Oct 4, 2026
- sudosubin/agents.nix“agent-skills.github.anthropics.claude-plugins-community: 0-unstable-2026-08-24 → 0-unstable-2026-10-01”GitHub · Oct 3, 2026
The biggest 5 of 50 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 50
Talked about on GitHub and Bluesky (50 times).
On GitHub · 45
- Oct 4, 2026claude-code-plugins.github.anthropics.claude-plugins-community: init at 0-unstable-2026-10-01 — sudosubin/agents.nix0 reactions
- Oct 3, 2026agent-skills.github.anthropics.claude-plugins-community: 0-unstable-2026-08-24 → 0-unstable-2026-10-01 — sudosubin/agents.nix0 reactions
- Oct 2, 2026ci: bump validate-plugins action to 87c843d — netopsengineer/axiom0 reactions
- Sep 25, 2026agent-skills.github.anthropics.claude-plugins-community: init at 0-unstable-2026-08-24 — sudosubin/agents.nix0 reactions
- Sep 22, 2026Agent Kunjani passed review but is missing from the plugin directory and community catalog — anthropics/claude-code0 reactions
40 more on GitHub
- Sep 20, 2026feat(skills): add archify, i-have-adhd, eli5 under github namespace — teamai-hub/teamai-cli-dev0 reactions
- Sep 18, 2026Track: Anthropic Claude Code plugin directory — RoboAdApp/robowrite-plugin0 reactions
- Sep 13, 2026Add eli5 skill for claude and codex — oinume/dotfiles0 reactions
- Sep 13, 2026eli5 skillのインストール — oinume/dotfiles0 reactions · 2 comments
- Aug 30, 2026claude-community に申請する — BoxPistols/ux-writing-dead-cliche0 reactions
- Aug 30, 2026dead-cliche の配布を個人公開から Claude 公式ディレクトリへ段階的に広げる — BoxPistols/ux-writing-dead-cliche0 reactions
- Aug 27, 2026Run `claude plugin validate --strict` in the gate and CI — rvenutolo/claude-pgrep-pkill-guard0 reactions · 1 comment
- Aug 26, 2026Github trending [anthropics/claude-plugins-community] 社区插件市场镜像库 — web1992/github-trending0 reactions
- Aug 25, 2026🔥 GitHub Trending AI 早报 · 2026-08-26 · Top 9 项目 — happydog-intj/ai-xiaohongshu-daily0 reactions
- Aug 25, 2026🔥 GitHub Trending AI 早报 · 2026-08-26 · Top 9 项目 — Mystery406/ai-xiaohongshu-daily0 reactions
- Aug 25, 2026🔥 GitHub Trending AI 晚报 · 2026-08-25 · Top 9 项目 — Mystery406/ai-xiaohongshu-daily0 reactions
- Aug 25, 2026🔥 GitHub Trending AI 晚报 · 2026-08-25 · Top 9 项目 — happydog-intj/ai-xiaohongshu-daily0 reactions
- Aug 25, 2026ci: bump validate-plugins action to a727be1 — netopsengineer/axiom0 reactions
- Aug 25, 2026Github trending [anthropics/claude-plugins-community] 社区插件市场每日同步 — web1992/github-trending0 reactions
- Aug 24, 2026Audit candidate: anthropics/claude-plugins-community — MarkQWu/agents-in-the-wild0 reactions
- Aug 23, 2026release: lvsea-jieshi v0.1.0 — lhylvsea/lvsea-jieshi0 reactions
- Aug 22, 2026ci: bump validate-plugins action to f4c9452 — netopsengineer/axiom0 reactions
- Aug 20, 2026Manual: Submit to Claude Code Marketplace — azrtydxb/procoder0 reactions
- Aug 19, 2026ci: bump validate-plugins action to 24a5ecd — netopsengineer/axiom0 reactions
- Aug 17, 2026Dérive catalogues détectée (2026-08-17) — CustomDigitalServices-Kevin/claude-config-studio0 reactions
- Aug 14, 2026ci: bump validate-plugins action to 2285a36 — netopsengineer/axiom0 reactions
- Aug 13, 2026ci: bump validate-plugins action to 0e38de0 — netopsengineer/axiom0 reactions
- Aug 12, 2026ci: bump validate-plugins action to bf9b7e6 — netopsengineer/axiom0 reactions
- Aug 11, 2026ci: bump validate-plugins action to 8e69ea5 — netopsengineer/axiom0 reactions
- Aug 10, 2026ci: bump validate-plugins action to 76c3395 — netopsengineer/axiom0 reactions
- Aug 9, 2026ci: bump validate-plugins action to 661d978 — netopsengineer/axiom0 reactions
- Aug 8, 2026ci: bump validate-plugins action to 8d73e67 — netopsengineer/axiom0 reactions
- Aug 7, 2026ci: bump validate-plugins action to 50e56e6 — netopsengineer/axiom0 reactions
- Aug 6, 2026ci: bump validate-plugins action to 80f42f5 — netopsengineer/axiom0 reactions
- Aug 5, 2026ci: bump validate-plugins action to 9247660 — netopsengineer/axiom0 reactions
- Aug 4, 2026ci: bump validate-plugins action to cdd3064 — netopsengineer/axiom0 reactions
- Aug 3, 2026ci: bump validate-plugins action to 534e1ae — netopsengineer/axiom0 reactions
- Aug 2, 2026ci: bump validate-plugins action to 2c3df91 — netopsengineer/axiom0 reactions
- Aug 1, 2026ci: bump validate-plugins action to 8a41041 — netopsengineer/axiom0 reactions
- Jul 31, 2026ci: bump validate-plugins action to 44dd422 — netopsengineer/axiom0 reactions
- Jul 30, 2026ci: bump validate-plugins action to 91947f6 — netopsengineer/axiom0 reactions
- Jul 22, 2026Marketplace, distribution, and launch — tallyfy/repeatable0 reactions · 2 comments
- Jun 15, 2026github.com/anthropics/claude-plugins-official/issues — anthropics/claude-plugins-official0 reactions
- Jun 3, 2026Epic: Preemptive name registration for 'agmsg' across plugin/skill ecosystems — fujibee/agmsg0 reactions · 4 comments
- May 24, 2026Plugin "taketomarket" Published on 2026-05-14 but missing from claude-plugins-community marketplace.json 10 days later — anthropics/claude-plugins-official0 reactions · 1 comment
On Bluesky · 5
- Aug 24, 2026claude-plugins-community: Community plugin marketplace for Claude Cowork and Claude Code. It has picked up 97 stars in the last week.… — @latreon.bsky.social2 likes and reposts
- Aug 24, 2026Claude Codeなどの機能拡張プラグインをまとめた公式コミュニティ向けのマーケットプレイスらしい 新しい拡張機能を色々探して試したい yug1224 starred anthropics/claude-plugins-community… — @yug1224.com1 likes and repost · 1 reply
- Aug 24, 20263. Anthropic Community Plugin Marketplace for Claude Code and Cowork LINK 4. Daedalus-150M Hybrid Architecture Optimized for CPU Inference… — @hackobar.bsky.social1 likes and repost · 1 reply
- Oct 1, 2026Claude-plugins-community provides a curated directory of third-party plugins for Claude Cowork and Claude Code instead of hunting across… — @latreon.bsky.social0 likes and reposts · 1 reply
- Aug 25, 2026📈 Today's GitHub Trending: 1. https://github.com/freestylefly/awesome-gpt-image-2 - JavaScript, 1698 stars today 2.… — @ghtrend.newsmast.social.ap.brid.gy0 likes and reposts · 2 replies
In this repository30 other files it gives its agents.
- eli5Skill
- quickdesignSkill
- testdino-auditSkill
- testdino-healthSkill
- testdino-manual-runsSkill
- testdino-manual-testsSkill
- testdino-releasesSkill
- testdino-runsSkill
- testdino-sessionsSkill
- tres-asc845-swap-reprice-skillSkill
- tres-asset-balance-validationSkill
- tres-data-collection-commitSkill
- tres-erp-rule-suggestionsSkill
- tres-explorer-tx-to-ledgerSkill
- tres-export-3rd-party-contactsSkill
- tres-import-contactsSkill
- tres-invoice-bill-matchingSkill
- tres-ledger-linkSkill
- tres-onboardingSkill
- tres-recon-gapsSkill
- tres-report-advisorSkill
- tres-report-analyzerSkill
- tres-report-createSkill
- tres-request-skill-updateSkill
- tres-rollup-reviewSkill
- tres-rollup-rulesSkill
- tres-settings-managementSkill
- tres-tx-storySkill
- tres-upload-tx-header-validationSkill
- tres-wallets-uploadSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
39 rules. About 0 are common, 22 are distinctive, and 17 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈22
Distinctive · estimate
This author's own choices. Worth a look.
17
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
All calls use the user-tres-finance MCP server (the TRES Finance MCP connector).
- Very specific: line 29
All variable keys and nested input fields MUST use camelCase (e.g.
- Very specific: line 35
Call get_viewer with no arguments.
- Distinctive: line 42
Before any cost basis calculation can run, the organization must have a strategy defined.
- Very specific: line 48
If defaultStrategy is returned (any valid value like FIFO, LIFO, etc.), the strategy is already set — skip ahead and inform the user:
- Distinctive: line 51
If no strategy is configured (the query returns null or an error), present the user with all available methods and ask them to choose:
- Distinctive: line 76
After confirming strategy, check the current calculation status (Section A) and offer to run or re-run the calculation:
- Very specific: line 80
If status is IN_PROGRESS, inform the user it's already running and offer to wait:
- Very specific: line 83
If status is DONE, show when it last ran and ask:
- Very specific: line 86
If status is ITEM_NOT_FOUND, this org has never calculated — proceed directly to trigger.
- Distinctive: line 88
When the user confirms (or on first-time run), trigger the calculation using the mutation in Section D.
- Very specific: line 90
Poll status: every ~10 seconds until status = "DONE".
- Distinctive: line 110
Use this when the user asks whether cost basis is running, done, or when it last ran.
- Distinctive: line 164
Use when the user wants to change the default strategy or set strategy periods.
- Distinctive: line 200
If updating to a period-based config, first fetch the existing periods (Section B) so you don't accidentally overwrite them — the mutation …
- Distinctive: line 203
After a successful strategy change, ask the user if they want to trigger a cost basis recalculation (Section D).
- Distinctive: line 210
Prerequisite: Before triggering, run Step 2 (strategy gate) to ensure a strategy is defined.
- Very specific: line 238
After a successful trigger (success: true), poll the status using the query from Section A.
- Very specific: line 248
Do NOT present results or offer report downloads until status is DONE.
- Very specific: line 258
Important: Use the assetBalance query (NOT organizationBalance).
- Distinctive: line 313
After fetching all pages, split the results into two groups:
- Distinctive: line 318
Use color coding: green/+ for gains, red/- for losses.
- Distinctive: line 338
When missing fiat issues are found, automatically look up historical prices using the pricing query (Section G.1) for each affected asset …
- Distinctive: line 347
Use standard number formatting:
- Very specific: line 396
Do NOT filter by type directly in the query — instead, fetch all issues and filter/group in the presentation.
- Distinctive: line 425
Use the TRES MCP pricing queries to fetch historical prices for tokens with missing fiat values.
- Very specific: line 502
Call getBatchStatelessPricingByAssetClass with one request per issue.
- Distinctive: line 510
If the user confirms, apply them using Section G.2 (bulk fiat edit).
- Very specific: line 512
Pricing sources to try: If the default source returns empty, try these apiSource values in order: COINMARKETCAP, CRYPTO_COMPARE, …
- Distinctive: line 528
If ALL pricing sources return empty for a token, inform the user and ask them to provide a manual price.
- Very specific: line 580
When applying prices from G.1, use the looked-up unit price and set the date range tightly around the transaction date (same day for …
- Distinctive: line 584
After bulk fiat edits, suggest the user trigger a cost basis recalculation (Section D).
- Distinctive: line 661
After creating, suggest triggering cost basis recalculation (Section D).
- Distinctive: line 783
After setting rules, suggest triggering cost basis recalculation (Section D).
- Very specific: line 891
Critical: Do NOT present the download link while status is IN_PROGRESS — the file has not been written to S3 yet and the link will return a …
- Distinctive: line 900
Confirm before writes: Always confirm with the user before executing any mutation (strategy change, reevaluation, spec-ID rules, bulk fiat …
- Distinctive: line 902
Recalculation reminder: After any configuration change (strategy, reevaluation, spec-ID, fiat edit), remind the user that cost basis needs …
- Distinctive: line 905
Locked periods: If a mutation fails with a "locked period" error, inform the user that the timestamp falls within a locked accounting …
- Very specific: line 908
Status check before trigger: Before triggering a recalculation, check the current status — if already IN_PROGRESS, let the user know it's …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TRES Finance — Cost Basis Management
End-to-end skill for managing cost basis calculation, strategy configuration, reevaluations, financial issue review, and related operations in TRES Finance.
MCP Server
All calls use the user-tres-finance MCP server (the TRES Finance MCP connector).
All variable keys and nested input fields MUST use camelCase (e.g. assetClassId, not asset_class_id).
Step 1 — Authenticate and confirm org
Call get_viewer with no arguments. Confirm the org name with the user if there
is any ambiguity.
Step 2 — Ensure a cost basis strategy is defined (gate before calculation)
Before any cost basis calculation can run, the organization must have a strategy defined. This step is a prerequisite gate — run it automatically whenever the user wants to calculate cost basis (Section D), or when they first ask for help with cost basis.
- Fetch the current strategy using the query in Section B.
- If
defaultStrategyis returned (any valid value like FIFO, LIFO, etc.), the strategy is already set — skip ahead and inform the user:"Your cost basis strategy is set to [STRATEGY]. Proceeding."
If no strategy is configured (the query returns null or an error), present the user with all available methods and ask them to choose:
"Before calculating cost basis, you need to choose a costing method. Here are the available strategies:
- FIFO — First-in, first-out. Earliest acquired lots are disposed first. The most common method.
- LIFO — Last-in, first-out. Most recently acquired lots are disposed first.
- AVG — Weighted average cost across all lots.
- MAX_GAINS — Disposes lowest-cost lots first, maximizing realized gains.
- MAX_LOSSES — Disposes highest-cost lots first, maximizing realized losses (useful for tax-loss harvesting).
- FIFO_IMPAIRMENT — FIFO with impairment accounting support (for orgs using impairment write-downs).
Which method would you like to use?"
- Once the user picks a strategy, set it using the mutation in Section C
(with an empty
strategyPeriodsarray if they just want a single default). - Then proceed to the requested operation (typically Section D — trigger calculation).
This gate ensures no calculation runs without an explicit strategy choice.
Step 3 — Run cost basis calculation
After confirming strategy, check the current calculation status (Section A) and offer to run or re-run the calculation:
- Fetch status using the query in Section A.
- If
statusisIN_PROGRESS, inform the user it's already running and offer to wait:"Cost basis calculation is currently in progress (started at [time]). Would you like me to wait for it to finish?"
- If
statusisDONE, show when it last ran and ask:"Cost basis was last calculated on [lastFinishedAt]. Would you like to recalculate now, or view the existing results?"
- If
statusisITEM_NOT_FOUND, this org has never calculated — proceed directly to trigger. - When the user confirms (or on first-time run), trigger the calculation using the mutation in Section D.
- Poll status every ~10 seconds until
status = "DONE". - Once done, automatically proceed to show results per asset (Section E) and financial issues (Section F).
This step ensures the user always has fresh results and understands the calculation state before viewing data.
Available operations
Based on the user's request, follow the appropriate section below. Many users will come in with a general question like "help me with cost basis" — in that case, run Steps 1–3 (authenticate, check strategy, run calculation), then show results.
A. Check cost basis calculation status
Use this when the user asks whether cost basis is running, done, or when it last ran.
query CostBasisGetStatus {
costBasisGetStatus {
status
firstStartedAt
lastFinishedAt
updatedAt
}
}status values: DONE, IN_PROGRESS, ITEM_NOT_FOUND (never calculated).
Report the status clearly. If IN_PROGRESS, let the user know it's still running
and they should wait. If DONE, report when it last finished.
B. View current cost basis strategy
Fetches the default strategy and any date-specific strategy overrides.
query GetCostBasisStrategyByDate {
getCostBasisStrategyByDate {
response {
strategyPeriods {
startDate
endDate
strategy
}
defaultStrategy
}
}
}Present the default strategy and any period overrides clearly. Strategies:
FIFO, LIFO, AVG, MAX_GAINS, MAX_LOSSES, FIFO_IMPAIRMENT.
Explain what each means if the user asks:
- FIFO — First-in, first-out. Earliest acquired lots are sold first.
- LIFO — Last-in, first-out. Most recently acquired lots are sold first.
- AVG — Weighted average cost across all lots.
- MAX_GAINS — Sells lowest-cost lots first, maximizing realized gains.
- MAX_LOSSES — Sells highest-cost lots first, maximizing realized losses (tax-loss harvesting).
- FIFO_IMPAIRMENT — FIFO with impairment accounting support.
C. Update cost basis strategy
Use when the user wants to change the default strategy or set strategy periods.
Always confirm with the user before executing — changing strategy affects all future cost basis calculations and requires a recalculation.
mutation UpdateCostBasisStrategyByDate(
$defaultStrategy: CostBasisStrategy!,
$strategyPeriods: [CBStrategyPeriodInput]!
) {
updateCostBasisStrategyByDate(
defaultStrategy: $defaultStrategy,
strategyPeriods: $strategyPeriods
) {
success
message
}
}Variables example:
{
"defaultStrategy": "FIFO",
"strategyPeriods": [
{
"startDate": "2024-01-01T00:00:00Z",
"endDate": "2024-12-31T23:59:59Z",
"strategy": "LIFO"
}
]
}CostBasisStrategy enum values: FIFO, FIFO_IMPAIRMENT, LIFO, AVG, MAX_GAINS, MAX_LOSSES.
If updating to a period-based config, first fetch the existing periods (Section B) so you don't accidentally overwrite them — the mutation replaces ALL periods.
After a successful strategy change, ask the user if they want to trigger a cost basis recalculation (Section D).
D. Trigger cost basis calculation
Prerequisite: Before triggering, run Step 2 (strategy gate) to ensure a strategy is defined. If none is set, the user must choose one first.
Starts (or restarts) the cost basis calculation. Can target specific assets or recalculate everything.
mutation TriggerCostBasis($assetClassIds: [Int]) {
triggerCostBasis(assetClassIds: $assetClassIds) {
success
}
}- To recalculate everything: pass
assetClassIds: null(or omit it). - To recalculate specific assets: pass an array of asset class IDs, e.g.
[42, 88].
To find asset class IDs, query assetBalance or assetClass first:
query AssetClasses($limit: Int) {
assetClass(limit: $limit) {
results { id symbol name }
}
}After triggering — poll until completion
After a successful trigger (success: true), poll the status using the
query from Section A. The calculation typically takes 10–60 seconds for small
orgs but can take minutes for large ones.
1. Trigger → success: true
2. Poll costBasisGetStatus every ~10 seconds
3. When status = "DONE" → proceed to show results (Section E)Do NOT present results or offer report downloads until status is DONE.
While IN_PROGRESS, show a brief wait message to the user.
E. View cost basis results per asset
Shows the cost basis breakdown per asset-wallet pair — total cost, realized gains, COGS, running inventory, and more.
Important: Use the assetBalance query (NOT organizationBalance). The
assetBalance query returns per-wallet asset rows, each with a nested
costBasis field from FifoCostBasisQuery.
query AssetBalanceWithCostBasis($limit: Int, $offset: Int) {
assetBalance(limit: $limit, offset: $offset) {
totalCount
results {
asset {
symbol
name
}
belongsTo {
name
}
calculatedBalance
assetFifoCostBasis
totalProfitLoss
costBasis {
costBasis
totalRealizedGains
totalShortTermRealizedGains
totalLongTermRealizedGains
totalCost
totalRunningInventoryQuantity
cogs
proceeds
runningBalance
}
}
}
}Variables: {"limit": 50, "offset": 0}
Paginate if totalCount > 50 — increment offset by 50 and fetch again until
all results are retrieved.
Key fields explained
assetFifoCostBasis— The total cost basis for this asset-wallet pair (top-level shortcut).totalProfitLoss— Total realized P&L (top-level shortcut).costBasis— Nested object with full detail (null if not calculated):costBasis/totalCost— Total cost of current inventory.totalRealizedGains— Net realized gains/losses.totalShortTermRealizedGains/totalLongTermRealizedGains— Split by holding period.cogs— Cost of goods sold for disposals.proceeds— Total proceeds from disposals.totalRunningInventoryQuantity— Current inventory quantity.runningBalance— Running token balance.
Presenting results — the full picture
After fetching all pages, split the results into two groups:
Group 1 — Assets with cost basis data (costBasis is not null):
Present as a table sorted by absolute realized P&L descending, with columns:
Asset, Wallet, Holdings, Cost Basis ($), Realized P&L ($).
Use color coding: green/+ for gains, red/- for losses.
Group 2 — Assets without cost basis (costBasis is null AND calculatedBalance != 0):
These are assets where cost basis was NOT calculated — usually because of missing
fiat values, no transactions, or unverified/spam assets. Present them separately
under a clear heading like:
Assets without cost basis data: The following assets have balances but no cost basis calculated. This typically means they have missing fiat prices that need to be resolved before cost basis can be computed.
Show: Asset, Wallet, Holdings, and a note about likely cause (spam token, NFT, missing fiat, etc.).
Always show both groups so the user sees the complete picture. If Group 2
contains any non-trivial assets (not spam/virtual), also run the financial
issues query (Section F) filtered to HIGH severity to check for missing_fiat
issues, and report them alongside.
When missing fiat issues are found, automatically look up historical prices using the pricing query (Section G.1) for each affected asset at the transaction timestamp. Present the looked-up prices to the user and offer to apply them using bulk fiat edit (Section G.2).
Recommended: Generate an HTML dashboard file with styled tables for both groups plus a financial issues summary. Save it to the outputs folder and share the link with the user.
Use standard number formatting:
- Fiat values >= $1M: "$X.XXXM", >= $1K: "$X.XXK", else "$X.XX"
- Positive gains: "+" prefix, negative: "-" prefix
F. View financial issues
Financial issues are problems detected during cost basis calculation — negative balances, missing fiat values, circular transfers, etc.
query FinancialIssues($limit: Int, $offset: Int, $severity: String) {
financialIssue(limit: $limit, offset: $offset, severity: $severity) {
totalCount
results {
id
type
severity
message
balanceImpact
assetClass {
id
symbol
name
}
assetClassId
internalAccount {
name
}
internalAccountId
tx {
identifier
timestamp
}
subTx {
id
amount
}
}
}
}Filter options
Important: Filter values must be lowercase — the API uses DB-stored values.
severity:"high","medium","low"- Do NOT filter by
typedirectly in the query — instead, fetch all issues and filter/group in the presentation. Thetypefilter uses internal DB values that may not match the display names.
Actual issue types returned
The type field returns lowercase strings like:
missing_fiat— Sub-transaction has no fiat price. Affects cost basis accuracy. Can be resolved with bulk fiat edit (Section G).negative_balance— Inventory went below zero (more sold than acquired). Usually means missing inflow transactions.result_was_rounded— Minor rounding occurred during calculation. Low severity.ignored— Sub-transaction was skipped (e.g. internal transfer to same account).no_opposite_tx— Internal transfer has no matching counterpart.circular_internal_sbxs— Circular dependency in internal transfer matching.
Group results by severity and present HIGH issues first. The most common pattern
is a handful of HIGH severity missing_fiat issues plus many LOW severity
result_was_rounded issues — summarize the LOW ones as a count rather than
listing each individually.
G. Fix missing fiat values
This is a two-part flow: first look up historical prices, then apply them.
G.1 — Look up historical token prices
Use the TRES MCP pricing queries to fetch historical prices for tokens with missing fiat values. This uses the platform's pricing engine which aggregates from CoinGecko, CoinMarketCap, exchanges, and other sources.
For a single asset at a specific timestamp:
query GetStatelessPricing(
$platform: Platform!,
$assetIdentifier: String!,
$currencies: [Currency]!,
$timestamp: DateTime
) {
getStatelessPricing(
platform: $platform,
assetIdentifier: $assetIdentifier,
currencies: $currencies,
timestamp: $timestamp
) {
prices
assetClassId
symbol
}
}Variables example:
{
"platform": "ETHEREUM",
"assetIdentifier": "0x...contractAddress",
"currencies": ["USD"],
"timestamp": "2020-11-24T09:01:26Z"
}For multiple assets at once (by asset class ID):
query GetBatchPricing($requests: [GetBatchPricesByAssetClassRequest]!) {
getBatchStatelessPricingByAssetClass(requests: $requests) {
prices
assetClassId
symbol
}
}Variables example:
{
"requests": [
{
"assetClass": "4272",
"currencies": ["USD"],
"timestamp": "2018-06-18T19:13:45Z"
},
{
"assetClass": "4272",
"currencies": ["USD"],
"timestamp": "2020-11-24T09:01:26Z"
},
{
"assetClass": "9082",
"currencies": ["USD"],
"timestamp": "2020-11-27T20:06:54Z"
}
]
}The prices field returns a JSON object like {"usd": 0.015}.
How to use this in the missing fiat flow:
- From the financial issues (Section F), collect each
missing_fiatissue'sassetClass.idandtx.timestamp. - Call
getBatchStatelessPricingByAssetClasswith one request per issue. - Present the results to the user:
"I found historical prices for the missing fiat transactions:
- CHSB on 2018-06-18: $0.015 per token
- CHSB on 2020-11-24: $0.085 per token
- vBUSD on 2020-11-27: $0.021 per token
Would you like me to apply these prices?"
- If the user confirms, apply them using Section G.2 (bulk fiat edit).
Pricing sources to try: If the default source returns empty, try these
apiSource values in order: COINMARKETCAP, CRYPTO_COMPARE, REGULAR_FLOW,
COINBASE, BINANCE, KRAKEN. Pass the apiSource field in the request:
{
"requests": [
{ "assetClass": "4272", "currencies": ["USD"], "timestamp": "2020-11-24T09:01:26Z", "apiSource": "COINMARKETCAP" }
]
}Important: The pricing query returns prices: {} (empty object) when no
price data is available — this is common for obscure, delisted, or DeFi-wrapped
tokens. Try multiple sources before giving up.
If ALL pricing sources return empty for a token, inform the user and ask them to provide a manual price. Suggest approximate values if you know the token (e.g. BUSD-pegged tokens ≈ $1.00).
G.2 — Bulk fiat value edit
Override fiat unit prices for an asset across a date range. Useful for fixing MISSING_FIAT issues or correcting OTC prices.
Always confirm parameters with the user before executing — this writes fiat values to potentially many sub-transactions.
mutation BulkFiatEdit(
$assetClassId: Int!,
$currency: Currency!,
$startDate: Date!,
$endDate: Date!,
$unitPrice: Float!,
$updateExistingFiat: Boolean
) {
bulkFiatEdit(
assetClassId: $assetClassId,
currency: $currency,
startDate: $startDate,
endDate: $endDate,
unitPrice: $unitPrice,
updateExistingFiat: $updateExistingFiat
) {
success
message
}
}Variables example:
{
"assetClassId": 42,
"currency": "USD",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"unitPrice": 1.0,
"updateExistingFiat": false
}updateExistingFiat: false(default) — only fills in missing fiat values.updateExistingFiat: true— overwrites all fiat values in the range.
To find the assetClassId, query assetClass by symbol first.
When applying prices from G.1, use the looked-up unit price and set the date
range tightly around the transaction date (same day for startDate and endDate)
to avoid overwriting prices on other transactions.
After bulk fiat edits, suggest the user trigger a cost basis recalculation (Section D).
H. Reevaluations and impairments
Reevaluations adjust the fair market value (FMV) of inventory lots at a specific point in time. Impairments are a special case where the FMV drops below cost.
H.1 — List reevaluations
query GetReevaluations($limit: Int, $offset: Int, $assetClassId_In: [ID]) {
reevaluation(
limit: $limit,
offset: $offset,
assetClassId_In: $assetClassId_In,
ordering: "-timestamp"
) {
totalCount
results {
id
timestamp
unitPrice
currency
isImpairment
assetClass {
id
symbol
}
appliedCostBasis {
id
totalCost
revaluedCostAdjustment
internalAccount {
id
name
}
}
}
}
}H.2 — Create reevaluation
Always confirm with the user before executing.
mutation CreateReevaluation($reevaluations: [ReevaluationObjectType]!) {
createReevaluation(reevaluations: $reevaluations) {
reevaluationIds
}
}Variables example:
{
"reevaluations": [
{
"unitPrice": "45000.00",
"timestamp": "2024-12-31T23:59:59Z",
"assetClassId": 1,
"currency": "USD",
"isImpairment": false
}
]
}isImpairment: false— standard reevaluation (mark-to-market).isImpairment: true— impairment write-down.
Creating a reevaluation also creates a manual transaction to represent the adjustment in the ledger. Inform the user of this side effect.
After creating, suggest triggering cost basis recalculation (Section D).
H.3 — Update reevaluation
mutation UpdateReevaluation(
$reevaluationId: Int!,
$unitPrice: Decimal!,
$timestamp: DateTime!,
$assetClassId: Int!,
$currency: Currency!
) {
updateReevaluation(
reevaluationId: $reevaluationId,
unitPrice: $unitPrice,
timestamp: $timestamp,
assetClassId: $assetClassId,
currency: $currency
) {
status
}
}H.4 — Delete reevaluation
mutation DeleteReevaluation($reevaluationId: Int!) {
deleteReevaluation(reevaluationId: $reevaluationId) {
status
}
}Deleting also removes the associated manual transaction from the ledger.
I. Spec-ID rules (specific lot disposal)
Spec-ID rules let the user specify exactly which acquisition lot to use when disposing of an asset — overriding the default strategy (e.g. FIFO) for specific transactions.
I.1 — View spec-ID rules
query CostBasisSpecIdRules(
$limit: Int,
$offset: Int,
$outflowSubTransaction_In: [String]
) {
costBasisSpecIdRule(
limit: $limit,
offset: $offset,
outflowSubTransaction_In: $outflowSubTransaction_In
) {
totalCount
results {
id
outflowSubTransaction {
id
amount
timestamp
asset { symbol }
belongsTo { name }
}
disposedLotSubTransaction {
id
amount
timestamp
}
amountToDispose
priority
}
}
}I.2 — Set spec-ID rules
Always confirm with the user before executing. This replaces all existing rules for the given outflow sub-transaction.
mutation SetSpecIdRules(
$subTransactionId: ID!,
$specIdRules: [SpecIdRuleInput]!
) {
setSpecIdRules(
subTransactionId: $subTransactionId,
specIdRules: $specIdRules
) {
success
}
}Variables example:
{
"subTransactionId": "12345",
"specIdRules": [
{
"disposedLotSubTransactionId": "67890",
"amount": 1.5,
"priority": 1
},
{
"disposedLotSubTransactionId": "67891",
"amount": 0.5,
"priority": 2
}
]
}subTransactionId— the outflow (disposal) sub-transactiondisposedLotSubTransactionId— the inflow (acquisition) sub-transaction to use as the cost lotamount— how much of that lot to disposepriority— processing order (1 = first)
After setting rules, suggest triggering cost basis recalculation (Section D).
I.3 — Delete spec-ID rules
mutation DeleteSpecIdRules($subTransactionId: ID!) {
deleteSpecIdRules(subTransactionId: $subTransactionId) {
success
}
}J. Full inventory configuration
By default, TRES trims old inventory lots to reduce storage. For specific transactions where the user needs the complete inventory queue visible, toggle full inventory saving.
mutation SetFullCostBasisInventoryConfiguration(
$subTransactionId: ID,
$enableFullInventory: Boolean
) {
setFullCostBasisInventoryConfiguration(
subTransactionId: $subTransactionId,
enableFullInventory: $enableFullInventory
) {
success
}
}This deletes existing cost basis records for the affected asset and triggers a recalculation automatically.
K. Export cost basis reports
TRES offers several cost basis report types. Use the availableReportTypes query
to find available exports, then trigger via organizationBalance:
query AvailableReports {
availableReportTypes {
name
exportType
entitiesType
llmDescription
}
}Cost-basis-related report types include:
COST_BASIS_STACK_PER_ACCOUNT— Inventory lots grouped by walletCOST_BASIS_STACK_PER_ASSET— Inventory lots grouped by assetCOST_BASIS_INVENTORY— Full inventory detailCOST_BASIS_ROLL_FORWARD— Period-over-period roll forwardREEVALUATION— Reevaluation records
To export, use organizationBalance with export parameters:
query ExportCostBasisReport(
$exportName: String,
$exportFormat: String,
$currency: String,
$outputFormat: ReportOutputFormat
) {
organizationBalance(
exportName: $exportName,
exportFormat: $exportFormat,
currency: $currency,
outputFormat: $outputFormat
) {
totalCount
}
}Variables example:
{
"exportName": "Cost Basis Stack Per Asset - April 2024",
"exportFormat": "COST_BASIS_STACK_PER_ASSET",
"currency": "usd",
"outputFormat": "XLSX"
}Then poll the report query until status = "DONE" and provide the download link:
query Reports($limit: Int, $offset: Int) {
report(limit: $limit, offset: $offset, ordering: "-created_at") {
totalCount
results {
id
name
status
downloadUrl
createdAt
}
}
}Critical: Do NOT present the download link while status is IN_PROGRESS —
the file has not been written to S3 yet and the link will return a NoSuchKey
error. Poll every ~10 seconds until status = "DONE", then present the
downloadUrl to the user.
Guardrails
- Confirm before writes: Always confirm with the user before executing any mutation (strategy change, reevaluation, spec-ID rules, bulk fiat edit, trigger calc).
- Recalculation reminder: After any configuration change (strategy, reevaluation, spec-ID, fiat edit), remind the user that cost basis needs to be recalculated for changes to take effect.
- Locked periods: If a mutation fails with a "locked period" error, inform the user that the timestamp falls within a locked accounting period and they may need to unlock it first.
- Status check before trigger: Before triggering a recalculation, check the
current status — if already
IN_PROGRESS, let the user know it's still running.
Limitations — not available via MCP
The following cost basis features exist in the backend but are NOT exposed through the MCP GraphQL API, so this skill cannot perform them:
- Per-wallet reallocation flow — The two-phase reallocation process (unified inventory -> per-wallet split) is an internal backend operation triggered by org settings, not directly callable via API.
- Viewing raw inventory queue details — The
assetRunningQueueFifofield is available onFifoCostBasisQuerybut returns large JSON blobs. The queue data is best viewed through the TRES dashboard or via exported reports (COST_BASIS_STACK_PER_ACCOUNT / COST_BASIS_STACK_PER_ASSET). - Short position / loan queue management — Short position tracking (loan queue) is configured at the org-settings level and computed automatically. There is no direct API to view or manipulate the loan queue.
- Cost basis calculation internals — The actual calculation engine (CostBasisCalculator, CostBasisManager) runs server-side. We can trigger it and read results, but cannot control the internal calculation flow, caching, or S3 queue persistence.
- Internal transfer cost basis mapping — How cost basis is carried over between wallets in internal transfers is automatic and not configurable per-transaction via the API.
For any of these, direct the user to the TRES Finance dashboard or suggest exporting the relevant cost basis report for offline analysis.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

