IB-WP-0016-T04: trading-literature profile

Ship a specialized profile for trading memoirs and market-structure
texts. The profile names eight entity categories (trader, market,
strategy, error, psychological_pattern, institution, instrument,
evidence_bearing_claim), five relation types (cause_effect,
lesson_evidence, risk_mitigation, actor_venue, strategy_outcome), and
four evaluation criteria (groundedness, lesson_clarity,
historical_context, overgeneralization_risk). Each is reflected in the
prompts and contracts so the LLM is steered toward operator-level
findings rather than biographical detail or moralising.

The generic profile remains the default. A 2-chapter Lefevre smoke run
with --profile trading-literature completes end-to-end with viable
metrics; 93 tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 18:59:45 +02:00
parent ba8c0a100c
commit df87e212a2
13 changed files with 502 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
# Entity Contract — Trading Literature
Each generated entity must be a Markdown artifact with:
- one top-level heading containing the entity title
- a `## Category` line containing exactly one of: `trader`, `market`,
`strategy`, `error`, `psychological_pattern`, `institution`,
`instrument`, `evidence_bearing_claim`
- a `## Definition` section
- optional `## Context`, `## Source Evidence`, and `## Review Notes`
sections
Entity titles should be stable, short, and reusable across chapters of
the same source. Do not include the chapter number in the title; that
provenance belongs in the source artifact, not the entity.

View File

@@ -0,0 +1,19 @@
# Evaluation Contract — Trading Literature
Each evaluation must be Markdown with YAML frontmatter containing:
- `artifact_id`
- `evaluator`
- `evaluated_at`
- `scores`
Scores must include all four criteria on a 0 to 5 scale, with 5 best:
- `groundedness`
- `lesson_clarity`
- `historical_context`
- `overgeneralization_risk` (higher = lower risk; an entity that
silently universalises a chapter-local claim scores low)
Optional `## Review Notes` should quote any specific lines from the
entity body that drove a low score on any criterion.

View File

@@ -0,0 +1,16 @@
# Relation Contract — Trading Literature
Each generated relation must be a Markdown artifact with:
- one top-level heading containing the relation title
- `## Subject`
- `## Predicate`
- `## Object`
- `## Relation Type` — exactly one of: `cause_effect`, `lesson_evidence`,
`risk_mitigation`, `actor_venue`, `strategy_outcome`
- optional `## Evidence` and `## Feedback Role`
Subject and object values should match generated entity titles whenever
possible. A relation whose subject or object does not correspond to any
extracted entity must include an `## Evidence` section that quotes the
phrase from the source supporting the link.

View File

@@ -0,0 +1,11 @@
# Summary Contract — Trading Literature
Each source summary should preserve:
- the narrator's actions and the market events they reacted to
- named strategies, instruments, venues, and institutions present in
the chunk
- explicit lessons or rules of thumb the chunk states
- evidence phrases (dollar figures, dates, counter-party names, tape
behaviour) useful for later extraction
- unresolved ambiguities or anachronisms a reviewer should flag

View File

@@ -0,0 +1,35 @@
id: trading-literature
name: Trading Literature
description: |
Infospace generation profile for trading memoirs, market-structure texts,
and operator narratives. Tunes entity, relation, and evaluation prompts
for traders, markets, strategies, errors, psychological patterns,
institutions, instruments, and the lessons drawn from them.
terminology:
source_chunk: Chapter or chapter-part of a trading memoir or market-structure text
entity: Trader, market, strategy, error pattern, psychological habit, institution, instrument, or evidence-bearing claim
relation: Typed link between two trading-literature entities (cause/effect, lesson/evidence, risk/mitigation, actor/venue, strategy/outcome)
entity_categories:
- traders
- markets
- strategies
- errors
- psychological_patterns
- institutions
- instruments
- evidence_bearing_claims
relation_categories:
- cause_effect
- lesson_evidence
- risk_mitigation
- actor_venue
- strategy_outcome
granularity:
default: |
Prefer durable trading concepts and operator-level lessons over biographical
detail or stock-price trivia. Each entity should be reusable across chapters.
evaluation_criteria:
- groundedness
- lesson_clarity
- historical_context
- overgeneralization_risk

View File

@@ -0,0 +1,34 @@
# Evaluate Trading-Literature Entity
Profile: {{ macros.profile }}
Evaluate the generated entity as Markdown with YAML frontmatter. Include
`artifact_id`, `evaluator`, `evaluated_at`, and a `scores` list. Score
each criterion on a 0 to 5 scale where 5 is best.
Required score names:
- `groundedness` — does the entity stay anchored to the source chunk,
with no invented dates, dollar figures, or quotes?
- `lesson_clarity` — for `strategy`, `error`, `psychological_pattern`,
and `evidence_bearing_claim` entities, is the operator-level lesson
stated crisply enough to be reused in later chapters? For purely
factual entities (trader, market, institution, instrument), score
this on the clarity of the definition.
- `historical_context` — is the entity placed correctly in the era and
venue of the source (e.g. early-1900s American equities) without
importing modern terminology or instruments?
- `overgeneralization_risk` — is the entity scoped narrowly enough to
resist becoming a vague universal claim? Higher score means lower
risk. Flag entities that quietly claim to apply to all markets or
all operators when the source restricts the claim.
Add a short `## Review Notes` section listing any specific lines from
the entity body that drove a low score on any criterion.
Entity artifact: {{ input.artifact_id }}
Entity title: {{ input.title }}
## Entity
{{ input.content }}

View File

@@ -0,0 +1,37 @@
# Extract Trading-Literature Entities
Profile: {{ macros.profile }}
Extract reusable infospace entities from the source chunk. Return one
Markdown bundle where each entity starts with `# Entity Title` and has a
`## Definition` section, plus a `## Category` line drawn from the list
below. Add `## Context` and `## Source Evidence` when the chunk gives
enough material; leave them out rather than inventing detail.
Allowed categories (use exactly one per entity):
- `trader` — a named operator, broker, manipulator, or counter-party
- `market` — a market, exchange, pit, or named instrument family
(e.g. the New York Stock Exchange, the cotton market, the bucket-shop
circuit)
- `strategy` — a named tactic, system, or recurring playbook
(e.g. pyramiding, scale buying, tape reading)
- `error` — a recurring mistake, anti-pattern, or losing habit
- `psychological_pattern` — a named cognitive or emotional habit that
drives decisions (e.g. tip-following, hope-against-evidence)
- `institution` — a firm, regulator, news organisation, or social venue
- `instrument` — a specific security, commodity, or contract
- `evidence_bearing_claim` — a concrete operator-level claim the text
asserts and partially supports (e.g. "amateurs buy on tips, pros buy
on tape"); preserve the supporting evidence in the body
Prefer entities that will recur across chapters. Avoid fictionalised
people whose role is purely narrative colour. Avoid wrapping a single
trade as an entity unless the trade is itself a teachable case.
Source title: {{ input.title }}
Source artifact: {{ input.artifact_id }}
## Source
{{ input.content }}

View File

@@ -0,0 +1,32 @@
# Extract Trading-Literature Relations
Profile: {{ macros.profile }}
Extract a small set of important relations from the source chunk. Return
one Markdown relation artifact per relation. Each artifact uses sections
`## Subject`, `## Predicate`, `## Object`, and `## Relation Type`. Add
`## Evidence` whenever the chunk supplies a concrete supporting phrase.
Use exactly one of these relation types per relation:
- `cause_effect` — one entity drives a measurable market or operator
outcome (e.g. a strategy causing a loss; a market event causing a
policy change)
- `lesson_evidence` — an `evidence_bearing_claim` is supported (or
undercut) by a concrete trade, event, or quote in the source
- `risk_mitigation` — a strategy, rule, or habit reduces a named risk
- `actor_venue` — a trader operates in a market, institution, or pit
- `strategy_outcome` — a named strategy is applied to a specific trade
or campaign and produces a labelled outcome (win, loss, scratch)
Subject and object values should match entity titles you would (or did)
extract in the entities stage. Skip relations whose subject or object
would be a one-off fictional flourish. Skip implicit moralising; prefer
relations the chunk actually evidences.
Source title: {{ input.title }}
Source artifact: {{ input.artifact_id }}
## Source
{{ input.content }}

View File

@@ -0,0 +1,23 @@
# Summarize Trading-Literature Source
Profile: {{ macros.profile }}
Summarize the source chunk as Markdown for a trading-literature infospace.
Preserve in this order:
- the narrator's actions and the market events they reacted to
- named strategies, instruments, venues, and institutions
- explicit lessons, rules of thumb, or warnings the text states
- evidence phrases (dollar figures, dates, tape behaviour, counter-party
names) that should guide later entity and relation extraction
- ambiguities or anachronisms that a reviewer should flag
Keep the summary to a single page; do not paraphrase the moral of the
chapter, only the material a downstream extractor needs.
Source title: {{ input.title }}
Source artifact: {{ input.artifact_id }}
## Source
{{ input.content }}

View File

@@ -0,0 +1,13 @@
# Synthesize Trading-Literature Report
Profile: {{ macros.profile }}
Synthesize a concise review report from the generated source summaries,
entities, relations, evaluations, and collection metrics. Group entities
by category (trader, market, strategy, error, psychological pattern,
institution, instrument, evidence-bearing claim). Surface the relations
whose `relation_type` is `lesson_evidence` or `strategy_outcome` first —
those are the operator-level findings a reviewer will want to read
before anything else. End the report with an explicit "Overgeneralization
risks" section that quotes any entities whose evaluation flagged that
score below 3.