vibe-trade / docs
v0.1 NSE · Dhan Talk to founders

The agentic harness for
autonomous trading

Six primitives that give an LLM everything it needs to trade on your behalf — and nothing more than you've authorised.

Vibe Trade is a harness — a structured environment that lets a large language model reason about markets, act on your behalf, and accumulate judgement over time, without you having to babysit it.

The core insight is that LLMs are already capable of sophisticated market reasoning. What they lack is infrastructure: a live connection to the market, a sense of time, a memory that persists across sessions, a monitoring loop that doesn't cost a fortune, and a trust model that ensures nothing happens without your consent. Vibe Trade supplies all of it.

The result is a trading agent you can give a strategy to in plain English — and then leave alone.

What is Vibe Trade?

Vibe Trade is the backend for agentic trading. Just as infrastructure platforms give developers a database, auth, and storage without making them build those systems from scratch, Vibe Trade gives an AI trading agent a live market connection, a scheduling system, a strategy memory, an audit trail, a monitoring loop, and a permission gate — without you having to build any of it.

You describe what you want to trade and why. The agent figures out how. The harness makes sure it runs reliably, accountably, and only as far as you've permitted.

🔌

Live market awareness

20 built-in tools covering broker execution, real-time quotes, candles, indicators, fundamentals, ETFs, news, and index data. The agent never reasons from stale training data.

🧠

Strategy memory that persists

The agent doesn't start from zero each session. A written Playbook anchors every decision it makes — consistent rules, consistent judgement, isolated P&L.

⏱️

Runs on its own schedule

Set a trigger once. The agent wakes itself up, reasons from live data, and acts — without you being present.

🔒

No trade without your consent

A code-level approval gate sits in front of every execution. You define what consent looks like at each level of autonomy.

The Harness

The word "harness" is deliberate. A harness doesn't replace the horse — it channels its capability into something controllable, directed, and safe. Vibe Trade does the same for an LLM.

An LLM on its own is powerful but directionless for trading. It has no state, no time, no broker connection, no memory of what it did yesterday, and no guardrails on what it can do next. The harness provides all of that as a set of interlocking primitives. Remove any one of them and the agent either can't act, or acts without accountability.

The Vibe Trade Harness
AGENT BOUNDARY EXTERNAL BROKER API wakes agent wakes agent constrains records trade request unlocks execution feeds market data LLM core reasoner Schedules when to run Heartbeat monitoring loop Strategies thesis + memory Learnings black book Permissions approval gate Market Tooling data + broker AGENT BOUNDARY EXTERNAL BROKER API wakes agent wakes agent records feeds data LLM core reasoner Schedules when to run Heartbeat monitoring loop Strategies thesis + memory Permissions approval gate Market Tooling data + broker Learnings black book

How Primitives Connect

The six primitives aren't independent modules — they compose into a single runtime loop. Here is the path for an autonomous Playbook run:

Runtime loop — autonomous strategy execution
01 Heartbeat
Tick fires, snapshot built
Prices and conditions fetched for all watched symbols. Evaluated every 30s during market hours.
02 Condition
Trigger condition evaluated
Deterministic conditions checked in code. Fuzzy conditions passed to a lightweight model for a yes/no answer. If nothing fires — quiet tick, no LLM call.
03 Strategy
Agent wakes, strategy loaded
Main agent starts with the full snapshot and the strategy thesis document in context. The agent knows its mandate, constraints, and capital rules.
04 LLM
LLM reasons, market tooling called
Agent fetches quotes, news, and positions. Synthesises a decision — trade or stand down — with full reasoning.
05 Permissions
Approval gate evaluated
Is this pre-authorised? Is autonomous mode active within budget? If yes — execute. If no — approval request sent via Telegram before anything moves.
06 Broker
Trade placed, result logged
Order sent via Market Tooling. Confirmation stored. Learnings records the full entry — what, when, why — regardless of outcome.
PrimitiveRole in the loopWithout it
Market ToolingGives the agent live data and the ability to executeAgent reasons in the dark; can't act on the market
HeartbeatMonitors conditions cheaply; wakes the agent only when something firesEither runs 24/7 (expensive) or misses time-sensitive triggers
TriggersDefines when and why the agent wakes up — time, price, or eventAgent runs once and is forgotten; nothing is automated
PermissionsCode-level gate before every trade; records every decisionAgent acts without consent; no audit trail
PlaybooksLoads the strategy document as context on every agent runEvery session starts from zero; no consistent identity or rules
LearningsLogs every action with reasoning; compounds edge over timeAgent makes the same mistakes indefinitely; no accountability
example app

Vibe Trade App

A local chat interface and automation harness that puts all six primitives in your hands — the fastest way to understand what these docs describe in practice.

Vibe Trade is a fully-featured AI trading agent built on the harness described in this documentation. Every primitive — Heartbeat, Triggers, Permissions, Playbooks, Learnings — is wired up and running. Install it, connect your Dhan account, and the full harness is live.

It's designed as an experience first. Talk to the agent, watch it reason in real time, approve or reject its trade suggestions, create Playbooks through conversation, and inspect every decision and the reasoning behind it.

GitHub: vibetrade-ai/vibe-trade

Install and run

terminal
$ vibetrade

 VibeTrade running at http://localhost:3001
  Click http://localhost:3001 if it doesn't open automatically

The browser opens automatically. Add your Anthropic API key and Dhan credentials at http://localhost:3001/settings.

The app runs entirely on your machine. Your API key, credentials, trade history, and Playbooks are stored in ~/.vibetrade/ and never leave your local environment.

What you can do with it

💬

Talk to your portfolio

Ask the agent what's in your positions, how they're performing, what the market is doing. It has 20 live tools — real prices, candles, indicators, order book, news.

📋

Create Playbooks in chat

Describe your strategy in plain English. The agent shapes it into a structured Playbook — entry rules, exit criteria, capital allocation, guardrails — then runs it autonomously.

Watch triggers fire

The Heartbeat loop runs in the background every 30 seconds. When a condition fires, you see it — and if it spawns a reasoning job, you see the agent's full thought process.

Approve trades in real time

Every trade recommendation arrives as a structured approval card with the exact order and every signal that led to it. One click to approve or reject.

📂

Review the trade journal

Every decision, every reasoning trace, every outcome — logged and browsable by Playbook or time.

🔧

Configure without code

Triggers, Playbooks, and consent modes are all managed through the UI or through conversation.

Requirements

DependencyNotes
Node.js ≥ 20The app runs as a local Node process
Anthropic API keyClaude Sonnet for reasoning jobs, Haiku for condition evaluation
Dhan accountFirst supported broker — credentials added at /settings after install

Start with chat before automation. The app is most useful as a live conversation partner first. Ask the agent to look at your positions, fetch a quote, or explain a stock's technicals. Once you're comfortable with how it reasons and what tools it has, give it a Playbook and let it run autonomously.


01primitive

Market Tooling

The bridge between the LLM and the market — the agent never reasons from stale training data.

An LLM's training data has a cutoff. It doesn't know today's price of SBIN, whether Nifty is up or down, what news broke this morning, or what positions you currently hold. Market Tooling fixes this by giving the agent 20 built-in tools that connect it to live market data and your broker — so every decision it makes is grounded in what's actually happening right now.

Broker tools

Vibe Trade ships with first-class support for Dhan. Additional brokers are on the roadmap. The API endpoints, request structures, and parsing logic are already handled. The agent calls plain-English actions; the primitive handles the broker-specific implementation.

Why maintained integrations matter: Broker APIs change. Dhan moved from V1 to V2 — naive code generation, even from strong models, will sometimes call the wrong endpoint. Market Tooling maintains these integrations so tool calls don't silently fail.

ToolWhat it doesApproval required
get_quoteLive price for one or more NSE equities or ETFsNo
get_index_quoteLive price for any NSE index via IDX_I segmentNo
get_positionsCurrent open positions with unrealised P&LNo
get_fundsAvailable margin and cash balanceNo
get_ordersPending and filled orders for the sessionNo
place_orderPlace a buy or sell order — equity or ETFYes
cancel_orderCancel a pending order by order IDYes

Market data tools

ToolWhat it does
get_historical_dataOHLCV candles for equities, ETFs, and indices across any timeframe
compute_indicatorsRSI, MACD, Bollinger Bands, SMA, EMA, ATR — computed from live OHLCV
get_fundamentalsP/E, EPS, market cap, revenue — stocks only, via Yahoo Finance
get_etf_infoFund family, expense ratio, top 10 holdings, sector weights — ETFs only
fetch_newsLatest market news from LiveMint RSS
get_market_statusWhether the market is currently open or closed
is_trading_dayWhether a given date is an NSE trading day
get_upcoming_holidaysNSE holiday calendar
search_instrumentsSearch for equities or ETFs by name or symbol
get_top_moversTop gainers and losers for any Nifty index
get_market_depthLevel 2 order book — bids and offers with quantities
get_index_constituentsAll stocks in any NSE index with symbol, name, and industry
compare_stocksSide-by-side comparison of equities or indices across key metrics

Extensibility

The built-in tools cover the most common data needs, but every trader has their own edge — a proprietary screener, an internal backtesting engine, a Bloomberg terminal. Vibe Trade will support registering custom tools by defining an endpoint, credentials, and a capability description the agent can read.

Coming soon. Custom tool registration is on the roadmap. Once available, any data source or capability you can describe can be added to the agent's toolkit.

02primitive

Heartbeat

Continuous market monitoring without continuous LLM inference — a lightweight loop that wakes the agent only when something matters.

Keeping an LLM running 24/7 is prohibitively expensive. But trading conditions don't wait — a stock might hit your entry price at 2:15pm on a Tuesday, and if nothing is watching, the moment passes. Heartbeat decouples monitoring from reasoning. A cheap process watches constantly. The LLM only runs when a condition fires.

The tick

Heartbeat runs on a fixed interval — every 30 seconds during market hours, slower when the market is closed. On each tick:

1

Build a dynamic snapshot

Fetch live prices for every symbol currently held and every symbol referenced in an active trigger. Not the whole market — just what's being watched. The scope adjusts automatically as your positions and triggers change.

2

Evaluate all active triggers

Check every trigger condition against the snapshot. Code conditions are evaluated in pure JavaScript — no LLM, no cost. LLM conditions are sent to a lightweight model (Haiku) with a single yes/no question.

3

Wake the agent — or stand down

If a condition fired: spin up the main agent with the full snapshot and Playbook context. If nothing fired: no LLM call, no cost. Quiet tick until the next interval.

Evaluation cost by condition type

Condition modeEvaluated byCost per tickExample
codePure JavaScriptNear zeroquotes['HINDALCO'].lastPrice >= 964
eventSystem event listenerZeroposition_opened, nifty_drop_percent
timeCron schedulerZero20 9 * * 1-5 — weekdays at 9:20am
llmHaiku (yes/no only)Minimal"Is any open position showing unusual movement relative to its average?"

The llm condition mode is what makes Heartbeat qualitatively different from a traditional rules engine. The agent can set instinct-based triggers — not just coded equations — and the cost of monitoring them stays negligible.

Heartbeat evaluation path per tick
01 Tick
Interval fires
Every 30s during market hours. Slower when the market is closed.
02 Snapshot
Market snapshot built
Prices, fundamentals, and candles fetched only for watched symbols — not the whole market.
03 Evaluate
All active triggers evaluated
Each trigger takes one of two paths depending on its condition type.
Deterministic
Evaluated in pure code
No LLM call — near-zero cost
e.g. BEL < 280
Fuzzy
Passed to Haiku for yes/no
Minimal cost, not full agent
e.g. "market sentiment turning?"
03primitive

Triggers

The automation primitive — every autonomous action the agent takes originates from a trigger.

A trigger is a condition and an action. When the condition becomes true, the action fires. There are no separate concepts called "schedules" or "reminders" — a cron expression is just a time-based condition, and everything resolves to the same two questions: when should this run? and what should happen when it does?

Anatomy of a trigger

Every trigger has the same shape. Here is a real stop-loss trigger from a live intraday session:

HINDALCO Short — Stop Loss triggerJSON
{
  "id": "2da93e8b-59c1-4493-ab64-685840048aeb",
  "name": "HINDALCO Short — Stop Loss ₹964",
  "scope": "symbol",
  "watchSymbols": ["HINDALCO"],

  "condition": {
    "mode": "code",
    "expression": "quotes['HINDALCO'].lastPrice >= 964"
  },

  "action": {
    "type": "hard_order",  // executes instantly — no agent involved
    "tradeArgs": {
      "symbol": "HINDALCO",
      "transaction_type": "BUY",  // cover the short
      "quantity": 3,
      "order_type": "MARKET"
    }
  },

  "expiresAt": "2026-03-11T15:15:00+05:30",  // auto-cancels at EOD
  "context": "Stop loss for intraday short. Entry SHORT 3 shares @ ₹957.95. Cover if price hits ₹964.",
  "status": "active"
}

Condition modes

ModeWhen it firesTypical use
codeWhen a JavaScript expression evaluates to true against the live snapshotStop-loss, price targets, portfolio-level drawdown guards
eventWhen a named system event occursPosition opened/closed, Nifty move above threshold, re-entry scans
timeOn a cron scheduleMorning scans, position monitors, EOD hard closes, EOD reviews
llmWhen Haiku answers "yes" to a natural language questionInstinct-based conditions that can't be expressed as a formula

Action types

TypeWhat happensAgent involved?Typical use
hard_orderTrade executes immediately in pure code — no reasoning, no approval queueNoStop-losses, price targets, EOD hard closes where latency matters
reasoning_jobAgent wakes up with trigger context and Playbook loaded, reasons, and may queue approvalsYesMorning scans, position monitors, re-entry decisions, event-driven reviews

hard_order vs reasoning_job: The distinction matters most for time-sensitive exits. A stop-loss that fires a reasoning_job will wait for the agent to wake up, reason, and queue an approval. A stop-loss that fires a hard_order executes the moment the price condition is met. For hard guardrails, use hard_order. For anything requiring judgement, use reasoning_job.

A real trigger stack — Aggressive Alpha

The full trigger architecture the agent registered for itself when running the Aggressive Alpha intraday Playbook — created automatically when positions were opened:

TriggerConditionActionScope
Alpha SL — HINDALCOcode — price ≥ ₹964 (short SL)hard_order BUY 3 MARKETsymbol
Alpha Target — HINDALCOcode — price ≤ ₹948 (target)hard_order BUY 3 MARKETsymbol
Alpha Trail — HINDALCOcode — price ≤ ₹938 (+2% move)reasoning_job — move SL to breakevensymbol
Nifty Drop Guardevent — nifty_drop_percent ≥ 1%reasoning_job — review all longsmarket
Nifty Spike Guardevent — nifty_rise_percent ≥ 1%reasoning_job — review all shortsmarket
Re-entry Scannerevent — position_closedreasoning_job — find next setupportfolio
Correlated Drawdown Guardcode — 2+ positions losing >0.75% simultaneouslyreasoning_job — review combined exposureportfolio
Time Stop Reviewcode — any position <0.5% move after 90 minreasoning_job — evaluate dead weightportfolio
Position Monitortime — every 30 min, 9:20am–3:10pmreasoning_job — VWAP, RSI, volume checkportfolio
EOD Hard Closetime — 3:10pm dailyreasoning_job — close all positionsportfolio

The agent registered all of these itself — from the per-position SL and target triggers to the portfolio-level guards. You described the strategy. The agent built the automation stack.

04primitive

Permissions

The trust primitive — a code-level approval gate that ensures no money moves without recorded consent.

Giving an AI access to your trading account is a meaningful act of trust. The obvious failure mode is an agent that acts on your money without your knowledge. But there's a subtler failure mode: an agent that asks for permission in chat, you say "yes", and that's treated as authorisation. That's gameable, ambiguous, and not a real record of consent.

The core principle: no trade can be placed without explicit, recorded consent. What consent looks like depends on how much autonomy you've chosen to give the agent.

The approval gate

Every reasoning_job that wants to place a trade must submit a request to the approval gate. The agent cannot bypass this. Even when it has concluded a trade is the right move, it can only queue the request — not execute it.

The request arrives as a structured approval card: the exact trade, the full reasoning behind it, and the context that led to the decision. Here is a real card from a live session — the agent's recommendation to exit a short ONGC position:

Approval request · Aggressive Alpha — Position Monitor reasoning_job
SELL · ONGC 11 shares MARKET order Close SHORT
🔴 EXIT SIGNAL — 3 SIGNALS FIRED on SHORT ONGC (Entry ₹269.00, LTP ₹271.75, −₹30.25 unrealised loss)

SIGNAL 1 — RSI DETERIORATION: RSI has risen to 56.52, crossing the 55 ceiling for short momentum. The downside thesis is losing steam — buyers are stepping in.

SIGNAL 2 — RECOVERY WITH ELEVATED VOLUME: Last two candles (179K, 260K) showed high-volume bouncing action. Price recovering from ₹271.2 back to ₹271.75. A SHORT needs sellers in control; this shows the opposite.

SIGNAL 3 — POST-1PM LOSS WITH NO CATALYST: It is 13:30 IST. Position is at −1.02% with no news driving ONGC lower. Hard SL at ₹273.04 is only ₹1.29 away. Holding risks a −1.5% loss; exiting now limits damage to −1.02%.

RECOMMENDATION: Exit now. Saves approximately ₹5.30/share vs letting it hit the hard SL.

This is not a chat confirmation. It is a timestamped, structured record — linked to the Playbook, the trigger that fired, and the agent's reasoning at the moment of decision.

Three levels of consent

hard_order and the pre-authorisation model

Some triggers bypass the approval queue entirely. A hard_order trigger — used for stop-losses and price targets — executes the moment its condition is met, with no agent involvement and no approval step. This is by design: a stop-loss that waits for your phone tap is not a stop-loss.

The consent for a hard_order is given when you create the trigger. At that point you're specifying the exact condition and the exact trade. The execution is just the fulfilment of a decision you already made.

Consent typeWhen givenWhere recorded
Trade-levelAt execution time — per tradeApproval queue — Approve / Reject
Trigger-levelWhen the hard_order trigger is createdTrigger record — condition + tradeArgs
AutonomousWhen Playbook guardrails are definedPlaybook document — mandate boundaries
05primitive

Playbooks

The agent's operating manual — a written strategy document that anchors every decision made on its behalf.

Every new LLM session starts from zero. Without a Playbook, ask the agent whether to buy Infosys today, close the tab, ask again tomorrow — and you might get a different answer. One instance looks at volatility and says wait. Another looks at fundamentals and says buy. Neither is wrong, but neither is yours. There's no consistent thesis, no discipline, no record of what you were trying to achieve.

A Playbook is the document that fixes this. It is a written strategy that the agent receives as context on every run — whether triggered by a schedule, a price condition, or a live chat. The agent reasons as: "I am running this Playbook. These are my rules. Given what I can see right now, here is what I should do."

What a Playbook contains

A Playbook is a markdown document. There is no rigid schema — you write it the way you'd brief a portfolio manager. In practice, effective Playbooks cover four things:

SectionWhat it capturesExample
Investment thesisWhy you're trading this and what you believe"Maximize intraday P&L by keeping capital deployed across 3 slots, trading momentum/breakout setups on liquid Nifty 100 stocks in both directions"
Rules and constraintsWhat the agent must and must not do"No new entries after 2:30 PM. Skip entry if available balance < ₹2,000. VIX > 22: use tighter SL parameters"
Entry and exit approachHow the agent identifies and sizes trades"LONG: price above VWAP, RSI 45–65, breaking above opening range high. Quantity = slot capital / price, round down"
Capital allocationHow much is deployed and how it's split"Slot A: ₹3,000 · Slot B: ₹3,000 · Slot C: ₹2,500 · Reserve: ₹500 (never deployed)"

You don't write this from scratch. You describe your intent in plain English, the agent helps you shape it into a document, and once you agree — it becomes the operating manual.

What a Playbook adds

Feature
Consistent agent identityEvery trigger and schedule tied to this Playbook loads the same document. The agent always knows which programme it's running.
Isolated P&L trackingTrades tagged to a Playbook are tracked separately. You can see exactly how a thesis is performing over time.
Capital allocation boundsThe Playbook specifies what's allocated. The agent reasons within those bounds and won't exceed them.
Playbook stateThe agent reads and updates strategy state — scanning, paused, position_open — so each run picks up where the last one left off.
Scoped LearningsObservations and distilled lessons are tagged to the Playbook they came from. Performance review is always in context of the specific thesis.

Playbook record

The actual Playbook record for Aggressive Alpha — the live intraday strategy used throughout these docs:

Aggressive Alpha — Playbook recordJSON
{
  "id": "84f56962-0f6b-4d71-b1ec-4c9721f88fdb",
  "name": "Aggressive Alpha",
  "description": "Aggressive intraday long/short momentum strategy trading up to 3 concurrent positions across Nifty 100 stocks, always keeping capital deployed.",
  "allocation": 9000,
  "state": "scanning",  // updated by the agent after each run
  "status": "active",
  "plan": "## Aggressive Alpha — Intraday Long/Short Momentum Strategy\n\n...",
  "createdAt": "2026-03-10T17:09:16.796Z",
  "updatedAt": "2026-03-11T07:31:15.671Z"
}
06primitive

Learnings

The agent's audit trail and compounding memory — an immutable record of every trade, every decision, and everything distilled from both.

LLMs don't naturally remember what they did. Ask an agent why it bought a stock last Tuesday and it may confabulate a reason, or simply not know. This is a foundational problem when AI is acting on your money: you need a ground truth it can't rewrite.

Beyond accountability, there's a compounding problem: without a record of what worked and what didn't, the agent makes the same mistakes indefinitely. Learnings solves both.

The trade journal

Every order placed through Vibe Trade is written to an immutable trade record. Each entry captures what happened, when, and — critically — why the agent decided to act. Here are real entries from a live session:

Trade records — Aggressive Alpha sessionJSON
[
  {
    "id": "6b2029a0-81e1-443f-85cd-e9f377182391",
    "symbol": "ONGC",
    "transactionType": "SELL",
    "quantity": 11,
    "executedPrice": 269.00,
    "status": "filled",
    "strategyId": "84f56962-0f6b-4d71-b1ec-4c9721f88fdb",
    "note": "Aggressive Alpha — Slot B SHORT. Below VWAP all session, RSI 45 falling, MACD negative, weak oil sector on bearish day. SL: ₹273.04, Target: ₹262.28",
    "filledAt": "2026-03-11 10:19:12"
  },
  {
    "id": "0c616b25-8f1b-4ea1-a2b8-4ddf3c4e0621",
    "symbol": "COALINDIA",
    "transactionType": "BUY",
    "quantity": 5,
    "executedPrice": 446.90,
    "status": "filled",
    "strategyId": "84f56962-0f6b-4d71-b1ec-4c9721f88fdb",
    "note": "Aggressive Alpha — Slot C LONG. Gapped up at open, holding above VWAP, RSI 56 with room to run, MACD positive. SL: ₹440.00, Target: ₹457.77",
    "filledAt": "2026-03-11 10:19:14"
  }
]

The note field is written by the agent at the moment of entry — the reasoning it used to make the decision, not a post-hoc summary. Every trade is auditable back to the exact thesis the agent was running at the time.

Playbook-level vs. global

Every record is tagged. Trades, trigger runs, and observations are all linked to the Playbook they belong to — or marked global if they weren't part of one. The agent can filter its entire history by Playbook: show me everything Aggressive Alpha did.

📂

Playbook-scoped

Did the strategy stay true to its rules? Where did it overtrade? Where did it miss entries? All answerable by filtering to the Playbook's history.

🌐

Global observations

Patterns that apply across all Playbooks — market-wide timing, instrument behaviour, model tendencies. Cross-strategy insights live here separately.

Compounding edge

At the end of each trading day, the agent reviews its history — reading through the trades placed, the reasoning written at the time, and the outcomes — and distils learnings from that review. These feed forward. A learning might propose tightening an entry condition, adjusting a rebalancing cadence, or flagging a pattern the agent kept getting wrong. Proposed changes require your approval; the agent does not edit the Playbook unilaterally.

End-of-day distillation is coming soon. The trade journal and audit trail are live today. The automated end-of-day review loop — where the agent reads its history and surfaces proposed learnings — is actively being built.

07coming soon

Skills

Reusable instruction modules that personalise how the agent behaves for specific tasks — loaded when relevant, ignored when not.

A Playbook defines what you're trying to achieve. A Skill defines how you like a specific recurring task done. Where a Playbook is the strategy, a Skill is the technique.

If you have a particular way of sizing positions, a checklist you run before entering a momentum trade, or a preference for how exit reasoning gets presented — that's a Skill. You write it once, and the agent reaches for it whenever that task comes up.

What a Skill looks like

A Skill is a markdown file: a name, a description the agent uses to decide when to reach for it, and the instruction content itself. The format is identical to Claude's skill files — intentionally familiar.

position-sizing.md
---
name: position-sizing
description: How I calculate position size for intraday trades. Use this
             whenever you need to determine quantity for a new entry.
---

Always size by risk, not by capital.

1. Determine the stop-loss distance in rupees (entry price - SL price for longs)
2. Risk per trade = 1% of available capital
3. Quantity = risk per trade / stop-loss distance, rounded down
4. Minimum 1 share. If quantity rounds to 0, skip the trade.
5. Never exceed 25% of available capital in a single position, regardless
   of what the formula gives you.

For intraday trades, always use INTRADAY product type. Never CNC.

How Skills are loaded

ContextWhich Skills are available
Live chatAll Skills in your library — the agent can reach for any of them freely
Playbook run (trigger or schedule)Only Skills attached to that Playbook — clean isolation between strategies

This mirrors how Skills work in Claude Code: you configure which Skills are available per project, and the model decides when they're relevant. Attach Skills to a Playbook the way you load Skills into a project.

Skills are coming soon. The Playbook context window already supports additional instruction modules. The Skills library UI and per-Playbook attachment are actively being built.


Primitives at a Glance

#PrimitiveWhat it gives the agentWithout it
01Market ToolingLive data and broker execution — 20 built-in tools, never reasoning from stale training dataAgent reasons in the dark; can't act on the market
02HeartbeatAlways-on monitoring loop that wakes the agent only when a condition firesEither runs 24/7 at full cost, or misses time-sensitive triggers entirely
03TriggersA condition and an action — the automation primitive that drives everythingAgent runs once and is forgotten; nothing is automated
04PermissionsA code-level approval gate with three consent modes and a full audit trailAgent acts without authorisation; no record of why
05PlaybooksA persistent strategy document loaded as context on every agent runEvery session starts from zero; no consistent identity or rules
06LearningsImmutable trade journal and compounding memory across every sessionAgent makes the same mistakes indefinitely; no accountability
07SkillsReusable instruction modules for specific recurring tasksAgent applies generic behaviour to tasks you've already taught it how to do

Full Data Flow

How a complete autonomous Playbook run flows through all the primitives — from Heartbeat tick to executed trade. This is a real session: Aggressive Alpha, 11 March 2026.

End-to-end — strategy trigger to executed trade
01 Heartbeat deterministic
Tick fires, snapshot built
Prices fetched for SBIN, ONGC, COALINDIA. Trigger condition evaluated: time cron */30 9-15 * * 1-5.
02 Schedule fires
Trigger condition met — agent woken
Trigger record updated. Agent instance started with trigger context and strategy ID.
03 Strategy loaded
Thesis document loaded as system context
Agent knows it's running Aggressive Alpha. Rules, constraints, and capital allocation are all in context.
04 Tooling tool calls
Agent reasons, tool calls made
LLM calls get_positions, get_quote, compute_indicators. Evaluates RSI deterioration, volume fade, post-1pm criteria across ONGC SHORT.
05 Permissions gate
Approval gate evaluated
3 signals fired on ONGC SHORT. Full reasoning written. Approval card queued — user approves at 13:32 via Telegram.
06 Broker executed
Trade placed via Market Tooling
place_order called: BUY 11 ONGC MARKET (close short). Order filled at ₹271.75. Order ID 341260311280802.
07 Learnings logged
Full entry written to trade journal
Symbol, quantity, price, Playbook ID, and the full exit reasoning at the moment of decision. Tagged to Aggressive Alpha. Available for end-of-day review.

The Position Monitor ran four times that day. At 9:30am it queued the ONGC exit, which was approved. At 10:00am it ran and took no action — logged as "no action needed." At 10:30am it queued exits for COALINDIA and HINDALCO. Every run, whether it resulted in a trade or not, is recorded in full.