Documentation
¶
Overview ¶
Command hedgefund is the multi-agent hedge-fund system built on top of optimizer/harness. All four agent objects are wired up: risk (risk.go), P&L (pnl.go), and research (research.go) each run standalone as a react.NewAgent ReAct loop; fund manager (manager.go) is the compose.Workflow that fans all three into one synthesized FundDecision -- a proposal only, never a real trigger (see manager.go's own top doc comment for why this package deliberately never gets real trigger access at all, unlike gitlab.noncepad.com/eflam/wiki/client/hedgefund's gated-but-present trigger tools).
Usage:
go run . -node risk -prompt "What's our real risk exposure right now?" go run . -node pnl -prompt "How has our value changed over the last week?" go run . -node research -prompt "Any new model ideas in the papers directory?" go run . -node manager -prompt "Should we do anything right now?"
manager.go is the fourth and last of the four hedge-fund agent objects: the fund manager. Unlike risk.go/pnl.go/research.go (each a standalone react.NewAgent ReAct loop), this is the compose.Workflow this whole package's design was originally scoped around: research, risk, and pnl run as independent, concurrent nodes fanning into one fund_manager node that weighs all three and produces a decision -- same fan-in shape go-wiki/client/hedgefund's own workflow.go uses (AddLambdaNode + AddInputWithOptions field mappings, wf.End()).
Real, deliberate design decision, consistent with this whole package's posture (see README/design notes this was scoped from): the fund manager here NEVER gets trigger access. FundDecision is a plain data structure mirroring optimizer/cmd/multimodel.go's own MultiModelCmd flags -- a proposal for a human to read and decide whether to act on, not something wired to a real multimodelv1.Hook at all. There is no gate to bypass here because there is no trigger tool in this package, full stop -- a stronger guarantee than "gated," since there's no code path to a real transaction to gate in the first place. (Compare go-wiki/client/hedgefund's own fund manager, which does hold gated trigger tools behind a *TriggerGate -- see that package's README for why the two hedge-fund builds took different approaches here.)
pnl.go is the second of the four hedge-fund agent objects: the P&L agent. Unlike risk.go (which reads live on-chain state via harness.WalletTools), this agent reads *recorded history* -- prefetch.db's pnl_position_snapshot table, the same data source this session's own "how much did I start with last week" investigation used by hand, now wrapped as a proper tool via the already-real prefetch/pnl package (pnl.PositionsBetween) rather than hand-rolled SQL. See optimizer/cmd/pnlbetween.go for the CLI equivalent this tool's formatting is adapted from.
research.go is the third of the four hedge-fund agent objects: the research agent. It reads local PDF/text/markdown files from a configured directory and proposes candidate trading-model ideas grounded in their content -- same ReAct-agent-over-narrow-tools shape as risk.go/pnl.go, not the batch load-everything-then-one-Generate-call shape optimizer/../go-wiki/client/hedgefund's own research.go uses (that package's own README documents why these two hedge-fund builds deliberately took different approaches to the same problem).
Uses eino's own document-parsing primitives rather than hand-rolling text extraction: eino core's parser.TextParser for .txt/.md, eino-ext's pure-Go PDF parser (github.com/ledongthuc/pdf underneath, no external binary needed) for .pdf.
Package main (hedgefund) is the real trading wallet's risk- analysis agent -- the first of the four agent objects from the hedge-fund design (fund manager, risk, P&L, research), built as a compose.Workflow node per that design's sketch. It is deliberately READ-ONLY: it reuses harness.WalletTools verbatim (see optimizer/harness/tools.go) rather than inventing its own on-chain queries, so this agent sees exactly what a human checking the wallet by hand would see -- the same check_obligations/get_wallet_balances/ get_portfolio_value_usd tools proven live against this exact wallet during the session this design was distilled from.
The persona below encodes the real risk mechanics of catscope-rust- bot's multimodelv1 mode (see optimizer/cmd/multimodel.go's own doc comment): pair, directional, and hawkes trade types all really borrow on Kamino/Solend for their short legs (real liquidation exposure); dispersion instead shorts via a real Phoenix SOL-PERP position (real funding-rate/margin exposure, not a lending-protocol borrow). A risk assessment that doesn't know this distinction can't reason about what's actually at stake in what it's looking at.
Source Files
¶
- main.go
- manager.go
- pnl.go
- research.go
- risk.go