portfolio-review
Skill0 starsChanged 39 days agoMITView on GitHub
Review a long-term Indian equity portfolio from a broker export. Refreshes fundamentals from screener.in, places each stock in the P/E vs ROE/ROCE signal rows, rates BUY / HOLD / SELL-trim, and writes a note per stock in stocks/. Use when the user asks about their holdings or a named stock: whether to buy, add, hold, trim or sell; a portfolio-wide sweep or refresh; or ideas for stocks outside the portfolio.
- Installs packages
19 other projects use a version of this.
Adopted by
Most recently taken up by
- VinodBobby/skillstheir own version, first seen Nov 29, 2026
- kanjiandahai/skills-collectiontheir own version, first seen Nov 29, 2026
- PatrickSUDO/fadacai-portfoliotheir own version, first seen Nov 26, 2026
- StalkC/stalkchain-plugintheir own version, first seen Nov 22, 2026
- CSPulse/customer-success-skillstheir own version, first seen Nov 8, 2026
- rgourley/quant-garagetheir own version, first seen Nov 1, 2026
Used with
Projects with it also use thesis-tracker and investment-research.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkillthesis-tracker
Use when building or updating Public Equity Investing thesis trackers. Do not use for generic news summaries, trade pitches, or first-pass memos.
Also in 3 projects that use this
edinetdbSkillinvestment-research
特定の日本株1銘柄について、企業概要・セグメント経済性・財務トレンド・株主構成・ガバナンス・リスク要因・競争優位の仮説・バリュエーション素材までを網羅した総合リサーチレポートを作る時に使う。「トヨタを分析して」「〇〇の株を調べて」のように1社を深掘りする指示で発火する。
Also in 3 projects that use this
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- digitalinnovationone/dio-agent★ 2.8ksame name
- PatrickSUDO/fadacai-portfolio★ 146same name
- Shubhamkumartrichy/claude-trading-skills-india★ 64same name
- nimadorostkar/Claude-Skills-collection★ 41same name
- Mozurok/fhorja.dev★ 10same name
- rgourley/quant-garage★ 7same name
- StalkC/stalkchain-plugin★ 4same name
- CSPulse/customer-success-skills★ 2same name
- ryanbaumann/fieldwork★ 2same name
- shashu10/personal-finance-skills★ 2same name
9 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- advance-taxSkill
- bond-portfolio-monitorSkill
- dsa-travelSkill
- html-slidesSkill
- itr2-filing-assistantSkill
- mutual-fund-reviewSkill
- my-spendingsSkill
- news-briefingSkill
- pdf-unlockSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
30 rules. 0 are common, 16 are distinctive, and 14 are very specific to this project.
0
Common
Most of the 17 edited versions we read keep these.
16
Distinctive
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 68
Never put in cloud storage: the fetch cache, snapshot-*.json, screen-*.json, multibagger-shortlist-*.json.
- Very specific: line 97
Every file moved through the connector costs tokens, and every decision about what to move is made by drive_sync.py, never by eye.
- Very specific: line 106
Not found anywhere: first run.
- Very specific: line 119
If check_first is set, run that search too: anything it finds is a file the listing left out, so save the results as one more …
- Distinctive: line 138
If the connector is unavailable: with a full local copy, say so and carry on.
- Distinctive: line 154
If today's snapshot does not exist yet, a subset run says so and promotes itself to a full refresh.
- Very specific: line 166
Add --refresh to bypass the cache and re-fetch live: python3 scripts/fetch_fundamentals.py --refresh STOCKA.
- Distinctive: line 180
If any ticker reports a fetch failure, say so plainly in your summary.
- Very specific: line 210
when the user asks how the book's sectors compare to the market, not just to itself: the snapshot's sector_weight_pct is the book's own …
- Very specific: line 278
Stale financials: If results_stale is true, the script already tried both consolidated and standalone pages.
- Very specific: line 282
Fiscal year: Read fiscal_year_end. Name quarters by their end month ("the Jun 2026 quarter").
- Very specific: line 288
If week52_check.agrees is false, say so and use the chart's closing range instead.
- Distinctive: line 289
Distorted multi-year figures: If a demerger, scheme of arrangement, merger or major divestment falls inside a multi-year window, label the …
- Very specific: line 294
One-offs in the two quarters you compare: Read one_offs. If latest.flag, quote pe_runrate_ex_one_off (or the company's pre-exceptional …
- Distinctive: line 374
If the block is empty, or only a PPT is listed, say guidance came from the presentation or from press coverage, and name which.
- Very specific: line 391
Auditor and governance red flags: Search <company> auditor resignation OR qualified opinion OR SEBI order OR forensic.
- Distinctive: line 431
Prefer recent Indian market sources.
- Distinctive: line 472
When you do run it: from the latest annual report or Secretarial Compliance Report's notes to accounts — the snapshot carries neither, and …
- Distinctive: line 563
Don't compute the ratio by hand — the snapshot has no fixed-assets field, and the number is rarely worth the scrape.
- Very specific: line 587
Valuation, honestly framed: When pe_runrate_diverges is true, neither trailing P/E nor the annualised quarter is usable alone.
- Distinctive: line 612
No argument may depend on the user's cost basis: Test each sentence: if it would change or vanish with a different average cost, delete it.
- Distinctive: line 664
The last tranche is conditional, and you are the condition: When the result lands, re-run the review.
- Distinctive: line 674
Materiality: If the position is under ~0.5% of the book, the Action must say whether to build it toward a named target weight or leave it …
- Distinctive: line 678
Say exactly what the number says: Write "debt-free" only when borrowings are nil.
- Very specific: line 685
Read note-template.md (beside this file) before writing or rewriting stocks/<TICKER>.md, and follow it exactly: the field set, the one-line …
- Distinctive: line 700
Explain any 10%+ move since the result: Search the news after the result date: a chairman exit, monthly sales, an export drop.
- Distinctive: line 706
If a check fails, fix the note, and the rating if its argument no longer holds, before writing the summary.
- Very specific: line 726
Run python3 scripts/fetch_fundamentals.py (no arguments, no --refresh) once more so PORTFOLIO.md picks up the new ratings from the …
- Distinctive: line 749
Never fabricate a timestamp: if the user didn't give an exact purchase time, write "not logged" rather than guessing, and offer to correct …
- Distinctive: line 755
After the scorecard(s), give the user the fuller summary: what changed versus the previous note (corrections first), and any rotation worth …
“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Request for this run: $ARGUMENTS
You are helping with a long-term Indian equity portfolio held with a broker. The goal is long-term compounding: hold quality names, average down where something is genuinely undervalued, and avoid value traps. Ratings are advisory only — never place or suggest placing an order.
Where things live. The master copy of everything the skill remembers is a portfolio-review/
folder in the user's cloud file storage, reached with whichever file-storage connector is
connected. It holds the broker export, slug-overrides.json, and skill-data/ with digest.json,
PORTFOLIO.md, entry-budgets.json, sell-plans.json, realised-gains-FY<fy>.json,
calendar.md, stocks/<TICKER>.md and three log folders, ratings-ledger/, scan-history/ and
realised-gains/. Its marker file, found by exact name, is
portfolio-review-sync.json.
Scripts work on a local copy under a working root: $PORTFOLIO_ROOT if set, else the working
directory, with the same split as the cloud folder:
data/directly — what the user provides: a broker CSV (broker_holdings_<date>.csv) or a lot-level broker export (broker-portfolio-<date>.md, seebroker-portfolio-template.md). With accounts at several brokers, one export per broker (the name's prefix is the broker); the fetch merges the newest of each, and a holding'sbrokersfield says how much sits where.data/skill-data/— everything the skill fetches or writes: the fetch cache,snapshot-*.json/screen-*.json, the notes,PORTFOLIO.md, the digest and the logs.data/notes.md, where present: the cloud folder's id and path. Read it first.
Scripts are in the scripts/ folder beside this file (${CLAUDE_SKILL_DIR}/scripts in Claude
Code). Run every command from the folder holding this file. In Claude Code with this checkout's
own data/, nothing else is needed. Where the skill was installed as a plugin, set PORTFOLIO_ROOT
on every command to a folder the user granted (it then keeps a full copy) or to a temporary one;
never write inside the skill's own folder there, because updates replace it. Install requests
with pip if it is missing. Write notes into data/skill-data/stocks/, not anywhere else.
Never put in cloud storage: the fetch cache, snapshot-*.json, screen-*.json,
multibagger-shortlist-*.json. Scripts regenerate them, and moving them through the connector
would cost far more tokens than fetching again.
Route the request first:
- Tickers the user holds → Steps 1, 3 and 4.
- Nothing named → Steps 1 and 2 only; do not research.
- A filter ("not analysed in 30 days", "all row-1 names") → the triage rule at the end of Step 2, then Step 3 for the shortlist only.
- A broad, market-wide search with no tickers named — asking to scan
the market, an index, or a sector for strong candidates against a
strict bar, wanting the search itself narrowed down rather than naming
candidates to check → read
multibagger-scan.md(beside this file) and follow it. Distinct from the next bullet: that one is for a narrower or already-named-candidate "what else is worth buying" ask. - Stocks they don't hold, or "what else is worth buying" → read
new-ideas.md(beside this file) and follow it. It reuses Steps 3b–3d and 3g. - Invoked from a plain question rather than
/portfolio-review: take the tickers from the user's message. If their scope is unclear and the fetch would be broad, confirm the scope before researching. - Selling, trimming or booking profit on a holding, whether a stock has peaked, or a sale the
user reports → read
sell-review.md(beside this file) and follow it. It reuses Steps 0, 1, 3b–3d, 3g and 4. - Tax-loss harvesting, gain booking, or "what should I sell for tax reasons" → Step 1, then
python3 scripts/tax_lots.py --harvest(3e). No per-ticker research needed unless the user then asks about a specific name it surfaces.
Step 0 — sync in
Every file moved through the connector costs tokens, and every decision about what to move is
made by drive_sync.py, never by eye. Its working files (.listing-N.json, .manifest-in.json)
live in the working root's data/ folder, which drive_sync.py reads by default.
- Find the cloud folder: the id in
data/notes.md, else search for the exact nameportfolio-review-sync.json; the folder holding it is the root. Download the manifest (base64), write it to a temp file, and runpython3 scripts/drive_sync.py put .manifest-in.json TEMPFILE --id ID --modified TS. That also tells a fresh working root where every folder is. Not found anywhere: first run. Ask the user which folder to use, runpython3 scripts/drive_sync.py init --root-id ID, and upload the local copy in Step 5 — or, to save retyping large files, ask the user to drag the local files into the matching cloud folders, then run that one plan with--adopt-same-size, which records each never-synced file whose cloud size equals the local size as synced instead of reporting a conflict. - List.
python3 scripts/drive_sync.py listing-queryprints one search query and where to save the results. Run it with the connector asking for metadata only (no content snippets), page through every result, and save each raw page as.listing-1.json,.listing-2.json, … in the working root'sdata/folder. - Plan.
python3 scripts/drive_sync.py plan --scope S [TICKER ...], with S from the route:tickerfor named stocks,sweepfor a portfolio-wide pass or a filter,scanfor a market scan,allwhen the working root keeps a full copy (always so in Claude Code). If the output'srelistis not empty, go back to step 2: the listing found folders its query did not cover. Ifcheck_firstis set, run that search too: anything it finds is a file the listing left out, so save the results as one more.listing-N.jsonpage and plan again. - Carry out the plan:
mkdir: create the folder with the connector, thenpython3 scripts/drive_sync.py folder PATH --id ID.download: fetch the file's content (base64), write it to a temp file, thenpython3 scripts/drive_sync.py put PATH TEMPFILE --id ID --modified TS.conflict(changed both here and in the cloud since the last sync): ifkeepisremote, runpython3 scripts/drive_sync.py conflict-copy PATH COPY, then download PATH as above. Ifkeepislocal, download the remote file into COPY (put COPY TEMPFILE --id ID --modified TS), thenpython3 scripts/drive_sync.py resolve-local PATH --id ID --modified TS; Step 5 uploads the local copy. Tell the user about every conflict copy.duplicate(two cloud files on one path): download the older one into itscopywithput, then move that file id to the bin. Tell the user.uploaditems are left for Step 5.
- Read
data/skill-data/digest.json(runpython3 scripts/digest.pyif it is absent). Open a full note only for a ticker this run re-rates.
If the connector is unavailable: with a full local copy, say so and carry on; the next run's plan uploads the backlog. With no local copy, stop and say the skill needs the connector.
Step 1 — refresh the data
Scope the fetch to what you are actually reviewing:
python3 scripts/fetch_fundamentals.py TICKER ... # refresh just those
python3 scripts/fetch_fundamentals.py # refresh everythingA subset run refreshes the named tickers and merges them into today's snapshot, so the other
holdings keep the rows the last full run gave them. Either way data/skill-data/snapshot-<today>.json and
PORTFOLIO.md end up complete — every holding in the CSV, not just the one you named.
If today's snapshot does not exist yet, a subset run says so and promotes itself to a full refresh; let it. That is the first run of the day paying for the network, and it is what makes every later run in the day nearly free. It takes several minutes (roughly ten for a book of several dozen holdings), which is longer than a default command timeout: start it with a long timeout or in the background, tell the user it is running, and use the wait for the 3a reading and the 3c searches.
Caching is per ticker per day, so a full rebuild from cache takes under a second and no network calls. Re-run freely — never skip Step 4 to save time.
For stocks the user does not hold, use --screen instead (see new-ideas.md); it never touches the
snapshot or PORTFOLIO.md.
Add --refresh to bypass the cache and re-fetch live:
python3 scripts/fetch_fundamentals.py --refresh STOCKA. Use it only when the user explicitly asks for fresh prices, or when a
same-day price move is itself the subject — the ratios only change quarterly, so on an ordinary
re-run the cache is the correct source.
The run also pulls promoter pledge, insider dealing and large-stake filings from NSE. Those are
cached for a week rather than a day, so only the first run of the week pays for them. --no-nse
skips them if NSE is down or slow; say so in your summary if you used it, because the pledge and
insider flags are then simply absent rather than clean.
PORTFOLIO.md carries a Prices fetched line and the last full-refresh time. If the user asks
about a holding you did not fetch this run, check that line before quoting its price, and say when
it was last fetched rather than implying it is live.
If any ticker reports a fetch failure, say so plainly in your summary. Never rate a stock whose ratios failed to load — report the gap instead.
Step 2 — if no tickers were named
Report what changed at the portfolio level and stop. Do not research anything:
- total P&L, the row distribution, and the top of the sector-exposure list
- everything under "Worth a look" in
PORTFOLIO.md, which is mechanical flags only — call out any "financials stale" flag first, since every ratio on that row is suspect - the sell lines in "Worth a look":
sell: <flag>is a new or stronger sell case,sell plan openis a saved plan (put any markedSTEP 2 TRIGGER HITat the top), andstill stretched, no changeis one line with no action. Offer a sell review for a flagged name rather than researching it (sell-review.mdexplains each line) - any holding whose signal row moved since the previous
data/skill-data/snapshot-*.json— before calling a move a "threshold crossing," checkprofit_yoy_pct(or the one-off–adjusted figure inone_offs) for that ticker. A P/E rising through a row boundary because profit fell is an earnings problem, not multiple noise, and must be named as such rather than filed as minor. Example: STOCKA moves from row 4 to row 3 because its P/E crossed 30 as TTM profit fell ~40% YoY (no one-off), not because the price re-rated — that is the single most material item to flag in the run, not an aside. - the "Risk and concentration" section: beta against the Nifty, the book's 1-year return against the index at today's weights, effective positions against the number actually held, and the tail of sub-0.5% positions. Report the effective-position count whenever the user asks whether they hold too many names — a long list of holdings is not the same number of bets, and that section says how many it really is. The 1-year return line applies today's weights to each holding's own 1-year price move, so it is not the user's actual return: never present it as their performance.
- the biggest rupee P&L contributors and drags across the book, not just the largest percentage movers — a small position's 40% gain can matter less than a large position's 8% move. The CSV and snapshot have position size and price move; compute this rather than eyeballing percentages.
- when the user asks how the book's sectors compare to the market, not just to itself: the
snapshot's
sector_weight_pctis the book's own concentration, not the Nifty's sector composition. Get the Nifty's sector weights from a WebSearch (same sourcing discipline as consensus targets — dated, from a named source) rather than approximating them, and say plainly if you can't find a current breakdown. - the "Notes on an old template" list, if present
Then tell the user they can run /portfolio-review TICKER ... to get a rating on any of them.
If $ARGUMENTS is a filter rather than tickers ("everything not analysed in 30 days", "all
row-1 names"), do not research the whole match. Triage it from digest.json (days since analysis, rating, signal row, due research) and the snapshot first: signal row,
one-off flags, technicals, profit trend, weight. Then propose a shortlist of the names where
changing the position is plausible, and research only those. List the rest as screened, not rated.
A filter can match dozens of names: the shortlist is the default, and full notes on every match
only if the user asks for them.
Step 3 — research each named ticker
For each ticker being researched (named in the request, or on the shortlist from a filter):
3a. Read what you already have
- The prior note at
stocks/<TICKER>.md, if it exists. Its rating, date and reasoning are the baseline you are updating. If it recorded management guidance, you will score it this run. - This run's entry in
data/skill-data/snapshot-<today>.json. Beyond the ratios, signal row, quarters, pros/cons andtechnicalsblock (seeCHEATSHEET.md(beside this file)), it carries:basis(consolidated or standalone),fiscal_year_end,latest_quarter_end,results_staleprice,fetched_at, and the holdings CSV'sltp/csv_date/price_vs_csv_pctweek52_check— screener's 52-week range against the chart's own daily closespe_runrateandpe_runrate_diverges— latest quarter annualised against trailing P/Eleverage— gross borrowings, D/E, debt/EBITDA and direction, from the last balance sheetone_offs— screener folds exceptional gains into Other Income, so this compares each quarter's other income with the company's own norm:latest.flag(run-rate P/E flattered),year_ago.flag(YoY not comparable),pe_runrate_ex_one_off,profit_yoy_ex_one_off_pct, andother_income_heavy(profit is mostly other income). Absent for lenders.cash_flow— five years of operating cash flow and free cash flow, andcfo_to_pat, the ratio of the two totals.applicableis false for lenders, whose operating cash flow is deposit and loan movement rather than a quality signal.ratio_history— five years of ROCE (ROE for lenders), debtor days, inventory days and the working-capital cycle, withroce_fadinganddebtor_days_stretching.growth_ranges— 10/5/3-year compounded sales, profit and price CAGR, and ROE by period, plusroe_vs_trendandearnings_above_trend/earnings_below_trend.shareholding— eight quarters of promoter, FII, DII and public holding, with*_change_ppover that window and the window itself.concalls— the last three earnings calls with dated transcript and PPT links.nse—pledge(share of promoter holding pledged, and as of when),insider(promoter and insider buying and selling by value over the last year) andsast(large-stake filings).market_risk—betaagainst the Nifty with ther2that says how much of the move the index explains, andtechnicals.max_drawdown_1y_pctalongside it.weight_pct,sector_name,sector_weight_pct,sector_peers
- The entry budget, if one is saved:
python3 scripts/entry_plan.py TICKERprints the user's budget for this stock, how much of it is in, and which tranches are left (3e). It exits saying none is saved if there isn't one. - The sell case and any open sell plan, on every review of a held ticker, before anything
else in this list is weighed:
python3 scripts/sell_signals.py TICKER. It prints the sell tier, the rise split into profit and P/E, and an open plan with the steps already done, so a plan is never forgotten (sell-review.mdreads the rest of its output). - What another session did. Notes, budgets and ledger entries written from another surface
arrive with the sync, as ordinary files. Treat a trade or decision recorded there the way you
would one the user told you: a budget goes through
entry_plan.py --budget, money already placed through--spent-so-far. It never changesqtyoravg_cost: those come only from the broker export, so until a newer export arrives say "recorded on<date>, not yet in the export" beside the position.
3b. Validate the data before reasoning from it
A confident conclusion built on a bad input is worse than no conclusion. Do these first.
- Stale financials. If
results_staleis true, the script already tried both consolidated and standalone pages. Treat the gap as a data-source problem until proven otherwise: find the company's latest filed result (NSE/BSE, the company's investor page) and use that. Never draw a conclusion about the business from the gap itself. - Fiscal year. Read
fiscal_year_end. Name quarters by their end month ("the Jun 2026 quarter"). Use FY labels only when they match that company's year end: many MNC subsidiaries close in December, and "FY to March" does not exist for them. - Price. Quote screener's price with its fetch date. If
price_vs_csv_pctis beyond ±2%, give the CSV's LTP andcsv_datealongside it, so the reader can see why the P&L differs from their broker. Never take a price or 52-week range from a web aggregator: they lag and disagree. Ifweek52_check.agreesis false, say so and use the chart's closing range instead. - Distorted multi-year figures. If a demerger, scheme of arrangement, merger or major divestment falls inside a multi-year window, label the figure not comparable and do not use it as evidence. Screener's auto-generated cons ("poor sales growth of X% over five years") inherit this blindly. The same applies to a one-off quarter (a scheme gain, an exceptional item) inflating ROE or deflating P/E. Use the like-for-like quarterly series instead.
- One-offs in the two quarters you compare. Read
one_offs. Iflatest.flag, quotepe_runrate_ex_one_off(or the company's pre-exceptional PAT), notpe_runrate. Ifyear_ago.flag, the reported YoY is not comparable;profit_yoy_ex_one_off_pctis a pointer, and the company's own like-for-like figure is the answer. When you strip a one-off yourself, compute both years on the same basis and cross-check against standalone. A consolidated-minus-gain figure can read +45% where standalone reads +30%, because the consolidated figure also carries swings in associates. The flag misses exceptionals below ~15% of PBT, so always check the result's exceptional-items line. - Absence of evidence in the NSE block.
nse.insider.stalemeans the endpoint's newest filing for that company is old, andavailable: falsemeans the call failed. Neither is evidence that insiders have not been selling — coverage is genuinely patchy (current for some large companies, years out of date for others, and empty for a few). Write "no insider dealing on file" only with the date of the newest filing beside it, and otherwise write that the data is unavailable. The same applies topledge: no disclosure on file is not proof of no pledge. - Policy and tax base effects, which the script cannot see. Before calling growth operational, ask what changed between the year-ago quarter and this one: a GST or tax change, a price control, or an exclusivity window opening or closing. The Sep 2025 GST cut on small cars and two-wheelers inflates auto volumes YoY until Oct 2026. The Feb 2026 cigarette tax resets cigarette makers' base until Feb 2027. Name the month the base laps.
3c. Search the web for what the numbers cannot tell you
First, reuse what is fresh. python3 scripts/freshness.py TICKER reads the note's Research
block. Items marked fresh are not searched again: carry them into the note unchanged, with their
original date. Search only for due items, and write what you find back into the Research block
with today's date.
- Consensus. For every target you quote, record the house, the rating, the date and the close it
was written against. A target is stale if it predates the latest result, or its reference
close is more than ~15% from today's price. Report how many of the targets you found are
post-result ("3 of 8 post-result"). If none are current, write consensus unavailable rather than
quoting it. The rules below exist because a target list has been wrong twice:
- A search answer is not a source. WebSearch's prose is a summary written by another model, and it invents targets. It has produced a "Buy, target ₹6,500" for a house whose actual call was a Sell at ₹5,000, and has relabelled one house's target as another's. A target counts only if you have seen it on a fetched page, or in a result title, that names the house, rating, target and date. Keep the URL for each one in your working.
- Search for the bears by name, e.g.
<company> sell OR underweight OR reduce target. Post-result roundups lean bullish, so the bear call is the one that gets dropped. - Check the year. Results mix "Q1 FY26" and "Q1 FY27" reports under the same quarter name. Year-old targets from three houses have surfaced as current. An undated target is unusable.
- Reference close:
python3 scripts/close_on.py TICKER YYYY-MM-DDprints the close on the report date and flags anything beyond 15%. Never use an aggregator's "price at report" column: Trendlyne's shows today's price on every row. - Sources: Trendlyne's research-reports page is dated but lags by weeks (it can be missing the latest month's reports). TradingView's Moneycontrol mirror ("Buy X; target of Rs N: Broker") and StreetInsider (foreign-house target changes) fetch reliably. Business Standard and Zee Business block fetches (403/402), so use their search snippets to find a call, then confirm it elsewhere.
- Broad "consensus" aggregators (S&P/stockanalysis.com, Trendlyne's own blended line, Univest, Alpha Spread) are not a cross-check baseline. Two pulls of the same aggregator on the same day for the same stock have disagreed by 5–10% (e.g. ₹1,200 avg / ₹1,300 high from one pull and ₹1,260 avg / ₹1,400 high from another, on the same day). If your named/dated average disagrees with an aggregator's headline number, that is not by itself evidence of an error — check whether the aggregator itself is stable before revising a target down to match it. The named, dated, post-result average is the deliberately narrower and more defensible number; don't let a noisier, wider one overrule it without a real reason (a target you missed, one that's actually stale, or a math error in your own average).
- If no named, dated brokerage target exists, say so precisely rather than "no analyst coverage": name that an unattributed aggregator figure may exist and was excluded per the rule above, so the reader knows the gap is a sourcing choice, not a blank screen. An aggregator consensus that is correctly excluded and then described to the user as "no analyst coverage" overstates the gap.
- The latest result, and the quality of its growth (see 3d).
- Management guidance from the latest earnings call or investor presentation: what was guided,
and when it was said. Guidance may be missed, but it must be recorded so the next note can score
it. If the prior note recorded guidance, check whether it was met.
Take it from the transcript, not from a summary of one. The snapshot's
concallsblock has the dated transcript and PPT links from the company's own filing. Read the latest one:curl -sL -A "Mozilla/5.0" -o /tmp/<TICKER>-concall.pdf "<transcript url>" pdftotext /tmp/<TICKER>-concall.pdf - | grep -inE "guidance|guide|outlook|expect|margin|capex|target" | head -40Then read the pages around the hits for the sentences themselves, and quote the speaker and the call's month. A concall transcript is a primary source in a way a news roundup is not — this is the same rule as the consensus targets in the bullet above, applied to guidance.
- If the block is empty, or only a PPT is listed, say guidance came from the presentation or from press coverage, and name which.
- Latest net debt, where
leverage.applicableis true andtrendis notlow. The snapshot's figure is gross, excludes cash, and comes from the last annual or half-year balance sheet, so the quarter's investor presentation is usually the better source. Date whichever you use. - Corporate actions, capacity changes, management changes, regulatory news. Search
<company> news <month> <year>alongside the concall and target searches above, not as an afterthought — a chairman exit, a raid or SEBI order, a plant shutdown or a licence issue rarely shows up in screener's ratios until the next quarter, but it is exactly the kind of thing that makes a rating stale between reviews.- Date a corporate action (OFS, buyback, block deal) from news coverage, not from the NSE
sastfiling date alone. The filing date can lag the actual event by a week or more — asastblock can date an OFS more than a week after the day it actually opened. A week's difference changes how "recent" the overhang reads and whether other price action in between is being correctly attributed to it. Search<company> OFS/buyback <month> <year>to confirm the actual date, and note if it was oversubscribed — that's a materially different read on whether the overhang has cleared than the bare fact that a sale happened.
- Date a corporate action (OFS, buyback, block deal) from news coverage, not from the NSE
- Auditor and governance red flags. Search
<company> auditor resignation OR qualified opinion OR SEBI order OR forensic. An auditor resigning mid-year, a qualified or adverse audit opinion, or an active SEBI/MCA order is a stronger and more specific red flag than anything the ratios can show, and it is missed entirely by a review that only reads screener's numbers. Absence of a hit is not the same as a clean record — say you searched and found nothing, dated, the same rule 3b.6 already applies to pledge and insider data.- Board-structure changes belong in the same search: an owner-promoter taking on both Chairperson and MD, an independent chairperson's term ending without a named successor, or a board seat count dropping below what listing norms require. None of this is inherently bad — say what changed and since when, not a verdict — but it changes how much weight the related-party-transaction check (3d) and the ownership data (3b.6) should carry going forward, so it belongs in the note, not just in memory for one review.
- Named peer valuation, for a BUY or SELL where the signal row's P/E classification is the load-
bearing argument. The signal row already places a stock against its own sector's P/E band
(
classification.pe_band), but that's a fixed range, not what the market is actually paying for comparable businesses today. Identify 2-3 named listed comparables (fromsector_peersif they're held, otherwise from a WebSearch or your own knowledge of the sector), then:
reads their P/E, ROE and ROCE off the samepython3 scripts/fetch_fundamentals.py --screen PEER1 PEER2 ...screen-<today>.jsona "what else is worth buying" scan already writes — no new fetch logic, and it never touches the portfolio snapshot. State the comparison plainly: this stock trades at a premium/discount to named peers, and whether its own ROE/ROCE justifies that gap or not. A richer multiple backed by materially better capital returns is a different case from the same premium on similar or worse returns. - Government or PSU ownership, where the promoter is the state.
shareholding's promoter figure already shows this; read what it implies rather than treating a PSU like any other promoter-held stock. Note the specific policy exposure by name (a disinvestment overhang, a subsidy or price-control dependency, a directive the company doesn't control commercially) rather than a generic "government-linked, so lower risk" or "government-linked, so higher risk" — either direction stated without the specific mechanism is a guess dressed as analysis. - Value migration, for a holding you already own, not only when sourcing a new one.
new-ideas.mdalready uses secular themes (ICE to EV, renewables, AI-linked capex, the public-to-private shift in defence/space/energy) as a sourcing hint for new candidates — ask the same question of an existing holding: is value moving toward this business's segment, or away from it toward a substitute or an adjacent business model further up or down the chain? A company can look statistically fine on every ratio above while sitting in a segment the market is structurally de-rating — that is a forward-looking, qualitative read, not something the ratios will show until the migration has already shown up in falling growth.
Prefer recent Indian market sources. If coverage is thin, which is common for smallcaps, say so rather than inventing a consensus.
3d. Decide a rating
BUY, HOLD or SELL / trim. Weigh the factors below by holistic judgment, not a formula — but three of them are named explicitly as carrying more weight than the rest, and one is named as subordinate, so when two factors disagree these are not equal votes:
- Price against the consensus target is called out below as the single strongest argument for trimming.
- Who is buying and selling the stock — specifically promoters cutting a stake — is called out below as the strongest single bear signal in the ownership data.
- The peak-earnings check (part of the signal-row re-check below) must run before, and can override, the growth-vs-price-paid read further down — a favourable PEG built on earnings the business is losing is not a real signal, so that check does not get to run as if the peak-earnings question were still open.
- Technicals are explicitly subordinate to all of the above: they decide the re-look price, never the rating itself.
Everything else below is weighed together, not ranked against each other by a fixed order:
- The signal row, checking it yourself when confidence is
lowor the row is printed with?. Also check it when confidence ishigh, if trailing earnings contain something that is leaving: an exclusivity window or limited-competition product, a commodity peak, or a one-off. The row is then built on earnings the business no longer has. Re-place it on guided forward earnings and override the confidence. A pharma name can read as high-confidence row 1 at ~12–16x trailing and be ~20–23x on guidance as its US exclusivities end. - Price against the consensus target, using current targets only. A price above the average target is the single strongest argument for trimming.
- Quality of growth. Separate what is operational from what is not: constant currency against reported, volume against realisation, mix (segment, channel, OE against replacement), other income, forex, inventory gains and one-offs. Say which drove the quarter. Mix shift toward a lower-margin channel does not reverse when input costs fall. When volume holds up after a tax or cost shock, check the segment margin before calling it resilience: volume can be bought with margin. Volume can fall only 5% because the company absorbed a tax rise, while that segment's EBIT falls 30%.
- The balance sheet. Leverage and its direction. Rising debt during a margin squeeze is how a cyclical problem becomes a structural one.
- Related-party transactions, gated to when it's worth the cost — every BUY/SELL (3g already
scopes deep verification to these), any ticker with a pledge or promoter-selling flag already
fired, or a small/thin-coverage name where less else is checking the promoter. Skip it for an
ordinary HOLD in a broad sweep and say so, rather than pulling an annual report for every ticker.
When you do run it: from the latest annual report or Secretarial Compliance Report's notes to
accounts — the snapshot carries neither, and this is easy to skip for lack of a concrete method,
so use one: fetch the annual report PDF from the company's investor page or BSE/NSE filings, then
pdftotext -layout <file>.pdf -(the-layoutflag matters — plainpdftotexton a multi-column financial table silently scrambles which number belongs to which line, and misattributed a dividend-to-parent line as a fee payment on one run, with no error to catch it), then read the RPT schedule itself. Don't grep for the section title alone — "related party" and "contingent liabilities" recur as running headers and TOC/cross-reference entries dozens of times before the note with actual numbers in a large annual report, sogrep -inA5 "related party"lands on a heading, not the transaction table. Grep for a distinctive line-item label instead ("Purchase of Goods", "Guarantees", "Dividend received", "Sale of Goods") to land on the disclosure with figures. Loans, guarantees or sales to promoter-linked entities off market terms, or transactions made without required Audit Committee approval, are red flags on their own, orthogonal to the pledge and insider checks above; size any RPT you find against net worth before calling it material — a small one that was later ratified is a line, not a rating driver. Contingent liabilities need sector-aware reading, not a blanket check.pros_cons.conssometimes already carries screener's auto-flagged figure — for a bank or NBFC this is off-balance- sheet notional (guarantees, forward contracts, derivatives) that is structurally large for that sector and not comparable to the same line for a non-financial company; don't flag it as a red flag by its size alone without checking the notes-to-accounts breakup for anything unusual inside it. - Growth against the price paid — but only after the peak-earnings check above, not instead of
it. Read
growth_ranges' 3/5-year profit CAGR alongside the P/E as a rough GARP cross-check (P/E at or below the CAGR is priced fairly for its growth). This CAGR is backward-looking, so if the signal row was just re-placed on guided forward earnings (exclusivity ending, commodity peak, one-off), do the same here: a favourable backward PEG built on earnings the business is losing is not a "cheap growth" signal, it's the peak-earnings case wearing a growth costume. A stock can read PEG ≈ 0.5 on a +30% five-year CAGR that was entirely one exclusivity window, while forward guidance implies a profit decline — use the guided figure, not the trailing CAGR, once 3d's exclusivity check has already fired. The 3-year case, for every BUY/SELL — this is the actual question (2-3 year upside, not the next 12 months) and the arithmetic is deterministic, so let the script do it rather than eyeballing a chart:
python3 scripts/three_year_case.py TICKER \ --fwd-eps-base N --fwd-eps-bear N --eps-asof YYYY-MM-DD [--div-yield-pct N]It builds the stock's own 5-10yr trailing P/E band from data already fetched (screener's annual EPS row against year-end closes, one extra long-history chart fetch), and a Nifty hurdle CAGR computed from NIFTYBEES's own realised price history — not a web search, so it can't go stale or get misquoted. Source
--fwd-eps-base/--fwd-eps-bearyourself first (guided or dated consensus EPS for the base case, a trend/normalised figure for the bear case — the same sourcing discipline as a consensus target); the script multiplies each against an exit P/E (the band's median for base, its low for bear, by default) to give a CAGR over the actual time to--eps-asof(the fiscal year-end that forward EPS is FOR — a fixed "3 years" is meaningless without knowing whether the EPS you sourced is one year out or four, and the script refuses to run without it once you pass--fwd-eps-base), and states plainly whether it clears the Nifty hurdle. A stock whose base case doesn't beat the index-fund hurdle by a real margin has a weak case for new money regardless of how the signal row reads. Run it without--fwd-eps-*to get the band alone — useful on its own for the peak-SELL read below. A short horizon (common — dated forward multiples rarely reach past the next fiscal year) inflates the annualised base/bear gap. The script flags this itself when the horizon comes out under 2 years and prints the un-annualised total price move alongside the CAGR; quote that total move in the note, not just the CAGR, so a modest EPS spread doesn't read as a near-binary outcome (a modest total-return spread reads as a near-binary gap once it is annualised over a horizon under two years). A dated, named EPS estimate is rarer than a price target — don't block on one. If nothing turns up (common: analysts publish price targets far more often than explicit EPS numbers), extrapolate from TTM EPS at management's own guided growth rate (credit growth, volume guidance, margin corridor — whatever the concall gave) instead. Label it plainly as your own extrapolation from guidance, not a consensus figure, in the note — the same distinction 3c already draws between a sourced target and an invented one. If the user (or a source you're weighing, e.g. a third-party research note) names a target multiple instead of a forward EPS — "can this double in 3 years", "is this a multibagger from here" — answer it with the same script rather than guessing at a growth rate by feel:python3 scripts/three_year_case.py TICKER \ --target-multiple 2.0 --eps-asof YYYY-MM-DD [--exit-pe-base N]This solves the reverse direction: given the target multiple and an exit P/E (the band's median by default), what EPS CAGR would the business need to sustain to get there. Weigh the printed CAGR against the company's own guided or trend growth rate — a target that implies materially faster growth than guidance or the trailing CAGR is the multibagger claim wearing an optimistic exit multiple, not a supported case, the same distinction 3d already draws for a backward PEG built on peak earnings.
- A SELL "because it's at its peak" needs the same test, not a feeling. Read the P/E band
output above: is today's P/E at or above the top of the stock's own historical range (the script's
percentile line), is
earnings_above_trendtrue, and is price already above the consensus average? Two of three together is a real peak case; one alone (a high percentile with earnings still on trend) is a re-rating, not a peak, and argues for HOLD, not SELL. - When the rating is SELL. HOLD stays the default, and SELL is reached in two named cases:
an exit window (a rise resting on P/E stretch, especially in a weak business) and a crisis exit
(current analyst calls and the frameworks agree the business is breaking). Read "When the rating
is SELL" in
sell-review.mdand apply it on every review, not only in a sell review. A SELL carries a staged plan fromsell_signals.py, never a size chosen by feel. - Reinvestment, as a qualitative read, not a computed ratio — manufacturing, mining and pharma
only. Is the company visibly plowing cash into capex while
roce_fadingis true (leverage.trendrising alongside falling FCF is the tell), or is growth coming from M&A/stake buys a fixed-assets ratio can't see anyway (a stake bought in another company is real reinvestment, and invisible to that math)? Don't compute the ratio by hand — the snapshot has no fixed-assets field, and the number is rarely worth the scrape. - Whether profit becomes cash.
cash_flow.cfo_to_patbelow ~0.6 over five years says reported profit is not arriving as cash, which is the value-trap tell the ratios miss. Read it withratio_history.debtor_days: profit that stays in receivables is the usual reason. Both are skipped for lenders, so say so rather than quoting a meaningless number. - The direction of returns, not just the level.
ratio_history.roceis five years of ROCE. A 15% ROCE on the way down from 30% is a different business from a 15% on the way up, and the signal row sees only today's figure.roce_fadingmarks the first case. - Whether the earnings the P/E rests on are normal.
growth_ranges.roe_vs_trendis last year's ROE over the five-year figure. Above ~1.4 (earnings_above_trend) the trailing P/E is resting on profits above the company's own history, so re-place the row on normalised earnings as 3d already requires for exclusivity and commodity peaks. This is the mechanical form of the peak-earnings case, e.g. 30% against 10% over ten years. It is not a complete test: a stock can read 17% against 19% and still be on peak earnings, because its problem is forward, not trailing. Below ~0.6 (earnings_below_trend) the opposite applies — a high P/E on depressed earnings is not automatically expensive. - Who is buying and selling the stock.
shareholdinggives eight quarters of promoter, FII and DII holding. Promoters cutting a stake is the strongest single bear signal here; FIIs leaving over many quarters is weaker and often flow rather than judgement, so treat a fall as context unless it is large. Where thenseblock is fresh, promoter pledge and insider selling belong in the same sentence. Never write that insiders are not selling from an absent or stale block (3b.6). - Management guidance, and the track record on the last guidance you recorded.
- Valuation, honestly framed. When
pe_runrate_divergesis true, neither trailing P/E nor the annualised quarter is usable alone. Give a low / base / high forward multiple, each with its assumption stated. Anchor the base case on management guidance or consensus EPS, not a number you picked. Screener's dividend yield is trailing. When earnings are falling, give a forward yield from guided EPS times the usual payout (e.g. 5.5% trailing, ~4.5% forward). Even whenpe_runrate_divergesis false (the gap didn't trip the script's threshold), ifpe_runrateis meaningfully higher than trailing P/E because of one soft quarter, lead with the run-rate figure in any one-line summary, not just in the note's fine print. A note can correctly say "size any add with 19x in mind, not the headline 12x," while a later summary to the user quotes only 12 — the caveat has to survive compression, not just exist in the note. - Portfolio context. Position weight, sector weight, and whether a same-sector holding already does the job better. The comparison for adding to STOCKA is STOCKA against STOCKB, its same-sector peer in the book, not STOCKA against cash. The CSV's sector tags understate some themes: truck and tractor-engine makers sit under Capital Goods but ride the auto cycle, so "Autos 9%" can really be ~12% auto-linked. Quote both figures when they differ, and frame a BUY in an already-heavy theme as a swap, not new money.
- Position within the 52-week range.
- The
technicalsblock, as a secondary input. Fundamentals decide the rating; technicals decide the re-look price. A row-1 name well below its 200 DMA with RSI near 30 is the "quality on sale" setup worth calling out, while a row-3/4 name below its 200 DMA is confirmation of the value trap, not a discount. Never upgrade a rating on an oversold RSI alone. Ignoredma200wheredma200_reliableis false.
3e. Recommendation hygiene — hard rules
- No argument may depend on the user's cost basis. Test each sentence: if it would change or vanish with a different average cost, delete it. "Adding lowers my average" and "adding would worsen an already-good position" both fail. The purchase price is sunk. The only legitimate use is tax (the long-term holding period — more than 12 months, not 12 months to the day — harvesting a loss, or booking a tax-free gain), and it must be labelled as tax.
A SELL or trim names which lots, using the script rather than eyeballing purchase dates:
python3 scripts/tax_lots.py TICKERIt reads today's snapshot's per-lot data and prints each lot's LT/ST status, days held, unrealized gain, and flags any short-term lot within ~60 days of turning long-term (20% → 12.5%, and exemption-eligible) — a real choice between selling now and waiting worth naming explicitly, not leaving implicit. A lot with no numeric cost (a demerger, an unreconciled corporate action) falls back to the position's own average cost, labelled as an estimate, rather than being dropped from every total — without the fallback, demerger-cost shares are silently excluded from the gain entirely, on exactly the position most likely to get a trim call. For the portfolio-wide view — realised gains this FY, LTCG exemption headroom, and which lots across every holding are the best gain-booking or loss-harvesting candidates — run
python3 scripts/tax_lots.py --harvestinstead. It reads the lot-level broker export's own "Tax position" section (present only in a lot-level.mdexport, not a plain CSV) for this FY's realised STCG/LTCG and the broker's own loss-harvesting estimate, so it isn't guessing at exemption headroom the way a single-ticker run has to. Realised gains are usually small early in the FY, which means loss-harvesting has little current-year value (it mostly creates a carry- forward) — the bigger lever is usually the unused LTCG exemption itself: booking LT gains up to that headroom before FY-end is tax-free, and--harvestnames the lots that do it.- The rating and the Action must agree. BUY means buying at today's price is right. If the level you would add at is more than ~5% below the current price, either rate it HOLD with "add at ₹X", or keep BUY and state the split: how much now, how much at the level. A BUY whose Action reads "Now: nothing" is a HOLD: if the reason not to add today is position size or a result due in a few weeks, rate it HOLD and name the trigger. A BUY with nothing to buy leaves the user asking, days later, whether to buy more.
Every BUY carries an entry plan from the script, not a lump sum sized by feel:
python3 scripts/entry_plan.py TICKER --budget RUPEES python3 scripts/entry_plan.py TICKER --target-weight-pct NThe budget is the user's number, and it is remembered: the first run with
--budget(or--target-weight-pct) saves it todata/skill-data/entry-budgets.json, and every later run with the ticker alone reads it back and counts what has been invested since against the tranches. So run it with no flag first, on every review of a holding — a saved budget changes what "add" means, and the user should never have to restate one. If none is saved, ask; never assume one from the size of the first purchase. If part of a budget being recorded has already been bought, pass--spent-so-far. Without a saved budget a review reasons from the first purchase as if it were the whole plan, when the user's budget was several times that. If the stock is falling (below its 200 DMA and well off its 60-day high — the script prints the test), it splits the budget into three tranches: one now, one at a named lower level or on a fallback date, one only after the next result. Otherwise it prints a single purchase. Put its tranches in the Action line and the scorecard as printed. Three things it does not do for you:- The last tranche is conditional, and you are the condition. When the result lands, re-run the review; if the deciding sentence no longer holds, say the remaining tranches are cancelled. Staged buying without that check is averaging into a value trap.
- Never say the stock is near its low. The plan exists because the low cannot be seen in advance; it spreads money across levels and across the result, it does not time a bottom.
- The budget does not grow because the price fell. A later tranche buys more shares for the same rupees. Enlarging the total is a new decision with its own review, and "it is cheaper than where I bought" is the cost-basis argument the first rule in this list already bans. A BUY that goes in as one purchase after the stock has dropped 10% in two weeks, with a result a month away, is the case this rule exists for.
- Materiality. If the position is under ~0.5% of the book, the Action must say whether to build it toward a named target weight or leave it as it is. A one-share add to a 0.2% position is not a recommendation. Where delivery trades carry no brokerage, this is about the position mattering, not cost.
- Say exactly what the number says. Write "debt-free" only when borrowings are nil; otherwise write "effectively debt-free (₹800 Cr, D/E 0.04)". Label trailing figures as trailing. Never put a percentage in a note that you computed across two different bases.
3f. Write the note
Read note-template.md (beside this file) before writing or rewriting stocks/<TICKER>.md, and follow it exactly: the field set, the one-line fields, the (prev ...) history, the UPGRADED/DOWNGRADED marker, Correction: lines, and the disclaimer footer. PORTFOLIO.md flags any note that drifts from it.
3g. Verify every BUY and SELL before you summarise
The user acts on ratings that change a position, and so far every error the user caught came from one of those. A HOLD can wait for the next review; a BUY or SELL gets this second pass first:
- Re-find each consensus target from its source. Drop any you can't find, recompute the average, and recount post-result targets. Confirm any Sell/Underweight call you found is in the average.
- Recompute every percentage in the note from the underlying numbers, with the same basis on both sides.
- Test the deciding sentence, the one that says why it is BUY rather than HOLD (or SELL rather than HOLD), against its driver. Is that driver operational, or a base effect, a one-off or an exclusivity? A BUY can rest on +30% volume that turns out to be mostly a tax cut.
- Explain any 10%+ move since the result. Search the news after the result date: a chairman exit, monthly sales, an export drop. It always has a reason worth a line.
- Date every ownership, pledge and insider claim, and check each came from the snapshot rather than from memory. A sentence about promoters or insiders with no date attached, or one drawn from a block marked stale or unavailable, comes out of the note.
If a check fails, fix the note, and the rating if its argument no longer holds, before writing the summary. Say in the summary that the pass ran, and what it changed.
Then record the rating to the ledger, for every note you wrote or rewrote in this step, whether or not it changed:
python3 scripts/rating_ledger.py record TICKER RATING PRICE "deciding sentence"RATING is BUY, HOLD or SELL (a trim is SELL). PRICE is the note's own snapshot price,
not a web price. The deciding sentence is the same one 3g.3 just tested — the reason this is BUY
rather than HOLD, or SELL rather than HOLD — quoted, so a later report run can read back exactly
what would have to hold up for the call to still be right. This is the only way the skill's own
record survives past the next rewrite: the note template's (prev ...) field keeps only one hop of
history, so without this step there is no way to score a rating once two more rewrites have passed
over it.
Step 4 — re-run and summarise
Run python3 scripts/fetch_fundamentals.py (no arguments, no --refresh)
once more so
PORTFOLIO.md picks up the new ratings from the stocks/<TICKER>.md files you just wrote. Every
ticker is already cached from Step 1, so this is a sub-second rebuild with no network calls — run
the full form here even when Step 1 was scoped, so the whole table is rebuilt.
Lead with a scorecard, one per researched ticker, before any prose. This is the chat-facing summary's required opening, not optional formatting — the detailed reasoning (what changed, the rotation discussion, everything else below) comes after it, not instead of it:
TICKER — Rating: BUY/HOLD/SELL | Row N (row's plain-English description)
As of: <data fetch date/time> | Purchase (if one happened this run): <date/time, or "not logged" if not given>
P/E N<x> (run-rate N<x> if it diverges), ROE N%, ROCE N%
Consensus <rating>, avg TP ₹N = N% <upside|downside> (<date>, <M> of <N> post-result — or "unavailable" per 3c)
3-Year case: base N% vs bear N% vs Nifty hurdle N%/yr — <clears|doesn't clear> [BUY/SELL only, from three_year_case.py]
Action: <what was done or should be done, per 3e — for a BUY, the entry_plan.py tranches>
Sell plan: <step N of 2 — sell Q of TOTAL now; step 2 below ₹N or the 50 DMA ₹N; core Q> [SELL, or an open plan]
Lots (FIFO, <account>): <Q sh, gain ₹N ST/LT, tax ₹N, net ₹N> [SELL, one line per account]
Break-even drop N% vs typical pullback N% — <the script's advice> [SELL with short-term lots]
Next check-in: <date/time, if a calendar reminder exists or was just set>Never fabricate a timestamp: if the user didn't give an exact purchase time, write "not logged"
rather than guessing, and offer to correct the line if they supply it. Omit the 3-Year case line
entirely for a HOLD, the same conditional rule note-template.md already uses. The three sell lines
are copied from sell_signals.py TICKER and appear only for a SELL, or for a HOLD whose sell plan
is still open; sell-review.md has a worked example.
After the scorecard(s), give the user the fuller summary: what changed versus the previous note (corrections first), and any rotation worth considering: where to trim and where that money could go, given the rest of the book and its sector weights. Keep it to a few sentences per stock.
When multiple BUYs share a sector or theme, say so in the summary, not just in each note. Each note's own Portfolio context line can carry a concentration caveat, but if the summary lists them as parallel, independent picks, the reader loses that they're two adds to the same bet. For example, BANKX and BANKY (both Financial Services, already a quarter of the book) and STOCKA and STOCKB (both auto-linked, about a tenth of it) presented as four separate BUYs with no mention that they pair up — state the shared exposure explicitly when it's there.
Sync out with Step 5 once every file this run writes is written (notes, ledger, budgets, calendar), and pass its one line on in the summary.
Offer the calendar candidates for any ticker researched this run:
python3 scripts/calendar_notes.py TICKER ...This writes data/skill-data/calendar.md with each ticker's estimated next-results window and its
technical re-look levels (200/50 DMA, 60-day low) — a deterministic date/price computation, not a
forecast. If a calendar connector is available in this session, offer to turn the rows into actual
events; otherwise point the user at the file so they (or another Claude session with a calendar
tool) can do it. Never treat the results window as a confirmed date — it is a reporting-lag
estimate (the filing deadline after the next quarter end), and many companies report on much the
same date every year. Check last year's date for that quarter and any board-meeting intimation
before proposing a reminder date.
A post-result re-check never goes on the result date or the morning after it. Once the result date is confirmed (and whether it comes out before, during or after market hours), get the reminder date from the script, passing any exchange holidays in between:
python3 scripts/calendar_notes.py --recheck YYYY-MM-DD --announced after-close [--holiday YYYY-MM-DD ...]It puts the re-check on the morning of the trading day after the first session that prices the
result, so the run has a post-result close and the first broker notes. When the timing is not
known, leave --announced off; it is then treated as after the close.
When a run is a post-result re-check, run that same command first. If today is before the date it prints, the result has not been priced or covered yet: do not do the full review. Say so in one line, give the printed date, and offer to move the reminder there.
On a portfolio-wide sweep, or when the user asks how past calls have done, score the ledger:
python3 scripts/rating_ledger.py reportThis is a fact report only — the recorded price, today's price, the realised return and the
deciding sentence recorded at the time, per rating. Reading whether that sentence actually held up
is your job, the same judgment call as everything else in 3d: pull the news and the results since
that date for anything the report flags as a large move or a long-held rating, and say plainly
whether the original thesis was right, wrong, or still open. Where it was wrong, name what you'd
change about how similar calls get made — that is the point of keeping the ledger at all, not just
a scoreboard. The ledger only starts counting from the first record call onward, so a first run
may show little or nothing; say that rather than treating an empty ledger as a clean track record.
End every reply with the glossary footer — Step 2 summaries and new-idea runs included. The user is still learning this vocabulary, so every abbreviation or piece of market shorthand in the reply gets its full form and a one-line explanation. The script holds the wording; do not write the explanations yourself:
python3 scripts/glossary.py --terms "RSI,EBITDA,200 DMA"It always includes the scorecard's own terms (P/E, run-rate P/E, ROE, ROCE, TP); --terms lists
whatever else the reply used (add --no-scorecard when the reply has no scorecard). Paste its
output verbatim after the prose and before the disclaimer. If it reports a term it has no line for,
add that term to GLOSSARY in the script rather than explaining it by hand, so the next run has
it. In the prose itself, prefer the plain word where one exists ("profit" over "PAT") — the footer
is for the shorthand that survives, not a licence to use more of it.
Close with: Not investment advice — verify prices and figures before acting.
Step 5 — sync out
The last tool step of every run that wrote anything:
python3 scripts/digest.py, with--mergeunless the scope wasallorsweep, so a copy holding only some notes does not shrink the shared summary.- List and plan again exactly as in Step 0 steps 2–3, re-listing while
relistis not empty. - Handle any
mkdir,download,conflictorduplicatethe same way as in Step 0 (another session may have written while this one ran), then plan again. - For each
upload: read the local file and create it inparentwith the connector (content typemime, no conversion to a native document type), thenpython3 scripts/drive_sync.py uploaded PATH --id NEWID --modified TS --size BYTESfrom the result. If it refuses (the size differs), bin the new file and upload again; otherwise moveold_id, if any, to the bin. python3 scripts/drive_sync.py manifest; upload the file it names asportfolio-review-sync.jsonin the root, then move itsold_id, if any, to the bin.- One line for the user: how many files went up, and any conflict copies.
A failure here never blocks the summary; report it. The next run uploads what is left.
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.

