Claude Skill

investment-decision

Run a clawock investment decision — read the prepared request, research with the host's own tools, write decision.json with evidence and an explicit bull/bear debate, and let Python validate and settle. Use when the user asks for an investment decision or a clawock run request is

LLM Mart · 0 points · 15 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download KCNyu-clawock-examples_dsh_packages_clawock-dsh_skills_investment-decision-d504fce.zip · 10 KB
Part of kcnyu/clawock — 17 skills

Install

skills CLI npx skills add https://github.com/KCNyu/clawock/tree/master/examples/dsh/packages/clawock-dsh/skills/investment-decision
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install kcnyu-clawock@llmmart
Git git clone https://github.com/KCNyu/clawock.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole kcnyu/clawock collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

clawock investment-decision

You are the model side of a clawock decision run. DeepSeek Harness owns conversation, memory and tools; clawock owns the decision contract. Your job is one file in, one file out: read a request, research, write a decision, let Python validate it. The model can never grade itself.

prepare ──► request.json ──► you: research + write decision.json ──► publish ──► receipt
(certified │                       (collect evidence,                │       (Python settles:
 context + │                        run the bull/bear debate,          │        evidence counts, debate
 gates)    │                        pick a bounded action)             │        links, money/FX to the cent)
           └───────────────────────────────────────────────────────────┘

Prerequisites

clawock must be installed (Python ≥ 3.11):

python -m pip install clawock

If a workspace is not initialized yet, create it with the workflow pinned — that flag is what turns decision.json into the enforced contract:

clawock init ./book --workflow investment-decision
clawock workflow install investment-decision --workspace ./book

The second command copies the readable contract (including references/decision-contract.md and the JSON Schema) into ./book/.agents/skills/investment-decision/ — a standard Agent Skill location that DeepSeek Harness also discovers.

The loop

1. Prepare

clawock run prepare --workspace ./book

Read the emitted request file (the request_file path printed on stdout, e.g. .clawock/work/<run_id>/request.json). It contains:

  • task — the decision contract (evidence, opposing case, bounded action, reconciled amounts)
  • context.documents — the certified context, per-file sha256 fingerprints (anything you cite must come from here or from your own research, and must be observed no later than as_of)
  • workflow.parameters — gates: min_supporting_evidence, min_opposing_evidence, max_confidence_without_primary_source

2. Research, then debate, then decide

Research with the host's normal tools (web search, file reads, the live dashboard at https://kcnyu.github.io/clawock/ as source_class: market evidence). Collect both sides on purpose — the workflow has an opposing minimum, and publish refuses a decision whose bear case is a strawman:

  1. Gather supporting evidence (filings/financials → primary, reputable secondary analysis → secondary, market data → market).
  2. Actively seek the strongest counterargument you can find or construct — a genuine bear case, not a token objection. Record it as opposing evidence.
  3. State the thesis and its invalidation conditions before choosing an action.
  4. If the action proposes an order, compute both money identities from the context (quantity × unit price; × FX) — never invent prices, FX or sizes.

Write decision.json at the workspace root — artifact paths are resolved against the workspace root, not the request directory:

{
  "schema_version": 1,
  "workflow": {"id": "investment-decision", "version": "1.1.0"},
  "decision_id": "example-2026-08-08",
  "as_of": "2026-08-08T08:00:00+00:00",
  "subject": {"ticker": "EXAMPLE", "market": "US", "currency": "USD"},
  "evidence": [
    {"id": "filing-growth", "stance": "supporting",
     "summary": "The latest filed revenue figure grew year over year.",
     "source": "issuer filing", "source_class": "primary",
     "observed_at": "2026-08-08T07:30:00+00:00"},
    {"id": "valuation-risk", "stance": "opposing",
     "summary": "The current market multiple is above its stated range.",
     "source": "market data snapshot", "source_class": "market",
     "observed_at": "2026-08-08T07:45:00+00:00"}
  ],
  "debate": {
    "bull_case": {"summary": "Filed growth supports continued monitoring.",
                  "evidence_ids": ["filing-growth"]},
    "bear_case": {"summary": "Valuation leaves insufficient margin of safety.",
                  "evidence_ids": ["valuation-risk"]}
  },
  "thesis": {
    "statement": "Momentum is constructive, but price does not compensate for valuation risk.",
    "confidence": 0.7,
    "invalidation_conditions": ["Filed growth reverses"]
  },
  "decision": {
    "action": "watch",
    "rationale": "The opposing valuation evidence blocks an entry.",
    "evidence_ids": ["filing-growth", "valuation-risk"],
    "order": null
  }
}

Rules that are enforced by clawock run publish, not by this file:

  1. debate.bull_case and debate.bear_case are both required and each cites evidence; the bear case must cite opposing-stance evidence — publish refuses without it. Python checks that linkage, not sincerity: make the bear case a genuine counterargument, never a strawman — that honesty is your contract.
  2. Every evidence row needs a stance (supporting | opposing | context), a source_class (primary | secondary | market | agent) and an observed_at no later than as_of.
  3. All evidence_ids references must exist (decision and both debate cases); conclusions in thesis.statement and decision.rationale should be backed by cited evidence.
  4. If you propose an order, the currency amounts must reconcile to the cent; let the numbers come out of the context, never invent them.
  5. Confidence above max_confidence_without_primary_source requires a cited primary source.

The sibling files next to this SKILL.md carry the full contract: references/decision-contract.md (with assets/order.example.json, an order-carrying decision whose two money identities reconcile). Introspect the exact artifact shape any time: clawock workflow schema investment-decision decision.json.

3. Publish and report

clawock run publish \
  --workspace ./book \
  --request ./book/.clawock/work/<run_id>/request.json \
  --artifact decision.json=./book/decision.json

Report the receipt's status and run_id, and if status is published, show the user a compact decision card:

Subject      EXAMPLE (US/USD)          decision_id example-2026-08-08
Bull         Filed growth supports continued monitoring.        [1 citing]
Bear         Valuation leaves insufficient margin of safety.    [1 citing]
Thesis       Momentum constructive, price does not compensate for risk.
Confidence   0.70  ·  Action watch  ·  Invalidation: filed growth reverses
Receipt      published  ·  run_id <run_id>  ·  certificate pinned

Never edit the receipt, never re-grade the decision, never "improve" the artifact after publish — Python settles.

Before publish: self-check

Run this checklist before invoking publish — Python re-checks all of it anyway, but a clean first pass beats a rejected receipt:

  • both debate.bull_case and debate.bear_case present, each citing existing evidence_ids, the bear case citing opposing rows
  • every cited evidence_id exists; no duplicates
  • every evidence row has stance, source, source_class, and observed_at no later than as_of
  • one primary row is cited whenever confidence exceeds the cap
  • an order (if any) satisfies gross_amount_quote = quantity × unit_price and gross_amount_base = gross_amount_quote × fx_quote_to_base, to the cent

If publish rejects

The receipt lists validation_issues with code + message. Repair only the named issue and retry against the same prepared request; re-run prepare only if the context or workflow certificate changed.

typical code meaning fix
unknown_fields / missing_fields a field name is wrong or extra align with the JSON example above; no reasoning, no opposing_case
insufficient_supporting_evidence / insufficient_opposing_evidence gate minimums not met add more evidence rows with that stance
unsupported_bear_case / unsupported_bull_case debate case cites the wrong stance point bear_case at opposing rows, bull_case at supporting rows
missing_evidence_reference evidence_ids names an unknown row only cite ids that exist in evidence
gross_amount_mismatch / fx_amount_mismatch order arithmetic wrong recompute quantity × unit_price and × fx_quote_to_base to the cent
confidence_without_primary_source confidence above the cap, no primary cited add a primary row and cite it in decision.evidence_ids
future_evidence observed_at after as_of backdate or fix timestamps

Where things land

path contents
<workspace>/decision.json your artifact (read by publish)
<workspace>/.clawock/work/<run_id>/request.json the certified request
<workspace>/.clawock/runs/<run_id>/ receipt + manifest (the settlement record)

Learn from outcomes

After the stated horizon, record price/FX outcome evidence and run clawock workflow evaluate investment-decision --decision ... --outcome .... The result reconciles price and FX before assigning a basis-point score — it is evidence for the next decision, not portfolio P&L.

Record conversation verdicts

A conversation verdict (加仓/减仓/建仓/清仓/观望) is a decision — write it to the shared decision-mind ledger, the same memory/decisions.jsonl the daily OpenClaw brief writes to, so both sides can read it and the daily settlement round-trips it:

clawock record \
  --subject 00100 --market HK --currency HKD \
  --action reject --confidence 0.65 --driven-by fundamental \
  --bull "营收 +159% YoY,入通/海外霸榜催化" \
  --bear "净利率 -2368%,资不抵债,z+2.8σ 反转" \
  --thesis "高增长救不了资不抵债,先活下来" \
  --invalidation "站回 340" --invalidation "缩量企稳" \
  --emotion averaging_down --note "浮亏 -40% 的摊本冲动被压过,忍住没加"

--source defaults to conversation for DSH; other harnesses pass their own — OpenClaw --source openclaw, Claude Code --source claude, Codex --source codex. One ledger, one record command, every harness calls it; nobody edits decisions.jsonl directly.

Rules: the bear case and at least one observable invalidation condition are mandatory (the command rejects weak records); be honest about emotion pressure — fomo/revenge/averaging_down are the exact patterns this ledger exists to surface. Full schema (in the repository, not in the npm tarball): https://github.com/KCNyu/clawock/blob/master/docs/decision-mind-ledger.md

Learn more

Live proof on a real HK + US desk: https://kcnyu.github.io/clawock/ The same contract from other harnesses (OpenClaw skill, Claude Code instruction, Codex AGENTS.md, pure CLI): https://github.com/KCNyu/clawock/tree/master/examples/dsh/packages/clawock-dsh

Files (clawock)
  • assets
    • decision.example.json 1.6 KB
      {
        "schema_version": 1,
        "workflow": {
          "id": "investment-decision",
          "version": "1.1.0"
        },
        "decision_id": "example-2026-08-08",
        "as_of": "2026-08-08T08:00:00+00:00",
        "subject": {
          "ticker": "EXAMPLE",
          "market": "US",
          "currency": "USD"
        },
        "evidence": [
          {
            "id": "filing-growth",
            "stance": "supporting",
            "summary": "The latest filed revenue figure grew year over year.",
            "source": "issuer filing",
            "source_class": "primary",
            "observed_at": "2026-08-08T07:30:00+00:00"
          },
          {
            "id": "valuation-risk",
            "stance": "opposing",
            "summary": "The current market multiple is above its stated comparison range.",
            "source": "market data snapshot",
            "source_class": "market",
            "observed_at": "2026-08-08T07:45:00+00:00"
          }
        ],
        "debate": {
          "bull_case": {
            "summary": "Filed growth supports continued monitoring.",
            "evidence_ids": [
              "filing-growth"
            ]
          },
          "bear_case": {
            "summary": "Valuation leaves insufficient margin of safety for a new entry.",
            "evidence_ids": [
              "valuation-risk"
            ]
          }
        },
        "thesis": {
          "statement": "Business momentum is constructive, but price does not yet compensate for valuation risk.",
          "confidence": 0.7,
          "invalidation_conditions": [
            "Filed growth reverses",
            "Valuation falls into the stated entry range"
          ]
        },
        "decision": {
          "action": "watch",
          "rationale": "The opposing valuation evidence blocks an entry despite constructive primary evidence.",
          "evidence_ids": [
            "filing-growth",
            "valuation-risk"
          ],
          "order": null
        }
      }
      
    • order.example.json 2.2 KB
      {
        "schema_version": 1,
        "workflow": {
          "id": "investment-decision",
          "version": "1.1.0"
        },
        "decision_id": "order-example-2026-08-08",
        "as_of": "2026-08-08T08:00:00+00:00",
        "subject": {
          "ticker": "0700",
          "market": "HK",
          "currency": "HKD"
        },
        "evidence": [
          {
            "id": "filing-growth",
            "stance": "supporting",
            "summary": "The latest filed revenue figure grew year over year.",
            "source": "issuer filing",
            "source_class": "primary",
            "observed_at": "2026-08-08T07:30:00+00:00"
          },
          {
            "id": "sell-side-target",
            "stance": "supporting",
            "summary": "A broker's HK$450 target exceeds the entry level.",
            "source": "broker research note",
            "source_class": "secondary",
            "observed_at": "2026-08-08T07:35:00+00:00"
          },
          {
            "id": "valuation-risk",
            "stance": "opposing",
            "summary": "The trailing multiple is above the five-year range.",
            "source": "market data snapshot",
            "source_class": "market",
            "observed_at": "2026-08-08T07:45:00+00:00"
          }
        ],
        "debate": {
          "bull_case": {
            "summary": "Filed growth and a broker target support a funded entry.",
            "evidence_ids": [
              "filing-growth",
              "sell-side-target"
            ]
          },
          "bear_case": {
            "summary": "The valuation leaves limited margin of safety at the entry price.",
            "evidence_ids": [
              "valuation-risk"
            ]
          }
        },
        "thesis": {
          "statement": "Filing-confirmed growth plus a small size makes the valuation risk acceptable; invalidation conditions bound the downside.",
          "confidence": 0.7,
          "invalidation_conditions": [
            "Next filing misses revenue",
            "Close below the invalidation level"
          ]
        },
        "decision": {
          "action": "add",
          "rationale": "Primary evidence supports growth; the small add and invalidation conditions bound the valuation risk.",
          "evidence_ids": [
            "filing-growth",
            "valuation-risk"
          ],
          "order": {
            "side": "buy",
            "quantity": "200",
            "unit_price": "310.00",
            "quote_currency": "HKD",
            "gross_amount_quote": "62000.00",
            "base_currency": "HKD",
            "fx_quote_to_base": "1",
            "gross_amount_base": "62000.00"
          }
        }
      }
      
    • outcome.example.json 478 B
      {
        "schema_version": 1,
        "workflow": {
          "id": "investment-decision",
          "version": "1.1.0"
        },
        "decision_id": "example-2026-08-08",
        "observed_at": "2026-08-09T08:00:00+00:00",
        "evidence": {
          "source": "broker closing-price export",
          "source_class": "broker",
          "quote_currency": "USD",
          "entry_price": "100.00",
          "outcome_price": "102.00",
          "base_currency": "HKD",
          "entry_fx_quote_to_base": "7.80",
          "outcome_fx_quote_to_base": "7.81"
        }
      }
      
  • references
    • decision-contract.md 4.6 KB
      # Decision artifact contract
      
      `decision.json` is the single required artifact for workflow version `1.1.0`.
      Unknown or missing fields are rejected so a producer cannot silently invent a
      parallel schema.
      
      The machine-readable shape is `decision.schema.json` in this directory. JSON
      Schema covers structure and primitive types; clawock's Python validator adds the
      cross-reference, provenance, opposing-evidence, action/order and arithmetic
      invariants that JSON Schema cannot express.
      
      ## Top-level fields
      
      - `schema_version`: integer `1`.
      - `workflow`: exactly `{"id":"investment-decision","version":"1.1.0"}`.
      - `decision_id`: stable non-empty identifier chosen by the calling runtime.
      - `as_of`: ISO-8601 timestamp with timezone.
      - `subject`: `ticker`, `market`, and quote `currency` strings.
      - `evidence`: traceable evidence rows.
      - `debate`: one bull and one bear case, each linked to evidence IDs.
      - `thesis`: statement, confidence from 0 to 1, and non-empty invalidation conditions.
      - `decision`: bounded action, rationale, evidence links, and optional order intent.
      
      ## Evidence
      
      Each row contains exactly:
      
      - `id`: unique non-empty string.
      - `stance`: `supporting`, `opposing`, or `context`.
      - `summary`: the observed fact, not an unsupported conclusion.
      - `source`: a stable locator or source name.
      - `source_class`: `primary`, `secondary`, `market`, or `agent`.
      - `observed_at`: ISO-8601 timestamp with timezone, no later than `as_of`.
      
      The bull case must cite supporting evidence and the bear case must cite opposing
      evidence. Every cited ID must exist. The configured workflow parameters control
      minimum evidence counts and the maximum confidence allowed without a cited
      primary source.
      
      ## Decision and order intent
      
      `action` is one of `buy`, `add`, `hold`, `watch`, `trim`, `sell`, `exit`, or
      `abstain`. `hold`, `watch`, and `abstain` carry `order: null`. Other actions
      carry an order with exactly:
      
      - `side`: `buy` or `sell`, consistent with the action.
      - `quantity`, `unit_price`, `gross_amount_quote`.
      - `quote_currency`, `base_currency`.
      - `fx_quote_to_base`, `gross_amount_base`.
      
      All numeric values must be positive and finite. clawock reconciles the two money
      identities to currency cents:
      
      `gross_amount_quote = quantity * unit_price`
      
      `gross_amount_base = gross_amount_quote * fx_quote_to_base`
      
      See `assets/decision.example.json` for a complete watch decision, and
      `assets/order.example.json` for an order-carrying decision with both money
      identities reconciled.
      
      ## Outcome evidence and evaluation
      
      Copy `assets/outcome.example.json`, preserve the decision/workflow identifiers,
      and replace the price, FX, timestamp, and source fields with observed evidence.
      Then run:
      
      ```bash
      clawock workflow evaluate investment-decision \
        --decision decision.json --outcome outcome.json --output evaluation.json
      ```
      
      The evaluator calculates quote-currency and base-currency market moves in basis
      points. `decision_value_bps` applies +1 to long/hold decisions, -1 to
      trim/sell/exit decisions, and 0 to watch/abstain. This is a reproducible
      directional evaluation, not realized P&L; portfolio cash, fills, fees, taxes and
      position size remain outside this artifact.
      
      ## Bounded improvement
      
      An external runtime or human can propose only parameters already bounded by
      `workflow.json`:
      
      ```bash
      clawock workflow propose --workspace . --trigger evaluation.json \
        --set min_opposing_evidence=2 \
        --rationale "Weak opposing evidence preceded the measured miss." \
        --expected-effect "Require a second independent opposing source." \
        --output proposal.json
      
      clawock workflow review --proposal proposal.json --decision accepted \
        --reviewer analyst@example --note "Evidence supports a bounded trial." \
        --output review.json
      
      clawock workflow apply --workspace . --proposal proposal.json --review review.json
      clawock workflow rollback --workspace . --change-id <change-id>
      ```
      
      The trigger can also be a rejected `clawock run publish` receipt. A proposal
      pins the workflow version/certificate, trigger hash, old/new values and expected
      effect. Apply refuses rejected or mismatched reviews, stale parameters, unknown
      settings and values outside their declared bounds. Rollback refuses to overwrite
      later parameter drift.
      
      This loop never launches a model, edits `SKILL.md`, changes OpenClaw memory/chat
      behavior or accepts its own proposal. Reasoning stays in the external runtime;
      clawock owns the evidence link, deterministic math and reversible adoption
      record.
      
      The bounded parameters change workflow evidence strictness only. They do not
      introduce or tune quantitative factors, catalysts, signals, entry/exit rules or
      portfolio construction; those remain part of the caller's existing strategy.
      
    • decision.schema.json 4.5 KB
      {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "urn:clawock:workflow:investment-decision:1.1.0:decision",
        "title": "clawock investment decision",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schema_version",
          "workflow",
          "decision_id",
          "as_of",
          "subject",
          "evidence",
          "debate",
          "thesis",
          "decision"
        ],
        "properties": {
          "schema_version": {
            "const": 1
          },
          "workflow": {
            "type": "object",
            "additionalProperties": false,
            "required": ["id", "version"],
            "properties": {
              "id": {"const": "investment-decision"},
              "version": {"const": "1.1.0"}
            }
          },
          "decision_id": {
            "type": "string",
            "minLength": 1
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "subject": {
            "type": "object",
            "additionalProperties": false,
            "required": ["ticker", "market", "currency"],
            "properties": {
              "ticker": {"type": "string", "minLength": 1},
              "market": {"type": "string", "minLength": 1},
              "currency": {"type": "string", "minLength": 1}
            }
          },
          "evidence": {
            "type": "array",
            "items": {"$ref": "#/$defs/evidence"}
          },
          "debate": {
            "type": "object",
            "additionalProperties": false,
            "required": ["bull_case", "bear_case"],
            "properties": {
              "bull_case": {"$ref": "#/$defs/case"},
              "bear_case": {"$ref": "#/$defs/case"}
            }
          },
          "thesis": {
            "type": "object",
            "additionalProperties": false,
            "required": ["statement", "confidence", "invalidation_conditions"],
            "properties": {
              "statement": {"type": "string", "minLength": 1},
              "confidence": {"type": "number", "minimum": 0, "maximum": 1},
              "invalidation_conditions": {
                "type": "array",
                "minItems": 1,
                "items": {"type": "string", "minLength": 1}
              }
            }
          },
          "decision": {
            "type": "object",
            "additionalProperties": false,
            "required": ["action", "rationale", "evidence_ids", "order"],
            "properties": {
              "action": {
                "enum": ["buy", "add", "hold", "watch", "trim", "sell", "exit", "abstain"]
              },
              "rationale": {"type": "string", "minLength": 1},
              "evidence_ids": {
                "type": "array",
                "minItems": 1,
                "uniqueItems": true,
                "items": {"type": "string", "minLength": 1}
              },
              "order": {
                "oneOf": [
                  {"type": "null"},
                  {"$ref": "#/$defs/order"}
                ]
              }
            }
          }
        },
        "$defs": {
          "evidence": {
            "type": "object",
            "additionalProperties": false,
            "required": ["id", "stance", "summary", "source", "source_class", "observed_at"],
            "properties": {
              "id": {"type": "string", "minLength": 1},
              "stance": {"enum": ["supporting", "opposing", "context"]},
              "summary": {"type": "string", "minLength": 1},
              "source": {"type": "string", "minLength": 1},
              "source_class": {"enum": ["primary", "secondary", "market", "agent"]},
              "observed_at": {"type": "string", "format": "date-time"}
            }
          },
          "case": {
            "type": "object",
            "additionalProperties": false,
            "required": ["summary", "evidence_ids"],
            "properties": {
              "summary": {"type": "string", "minLength": 1},
              "evidence_ids": {
                "type": "array",
                "minItems": 1,
                "uniqueItems": true,
                "items": {"type": "string", "minLength": 1}
              }
            }
          },
          "positive-number": {
            "oneOf": [
              {"type": "number", "exclusiveMinimum": 0},
              {"type": "string", "pattern": "^(?:0*[1-9][0-9]*(?:\\.[0-9]+)?|0*\\.[0-9]*[1-9][0-9]*)$"}
            ]
          },
          "order": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "side",
              "quantity",
              "unit_price",
              "quote_currency",
              "gross_amount_quote",
              "base_currency",
              "fx_quote_to_base",
              "gross_amount_base"
            ],
            "properties": {
              "side": {"enum": ["buy", "sell"]},
              "quantity": {"$ref": "#/$defs/positive-number"},
              "unit_price": {"$ref": "#/$defs/positive-number"},
              "quote_currency": {"type": "string", "minLength": 1},
              "gross_amount_quote": {"$ref": "#/$defs/positive-number"},
              "base_currency": {"type": "string", "minLength": 1},
              "fx_quote_to_base": {"$ref": "#/$defs/positive-number"},
              "gross_amount_base": {"$ref": "#/$defs/positive-number"}
            }
          }
        }
      }
      
  • SKILL.md 11.1 KB
    ---
    name: investment-decision
    description: Run a clawock investment decision — read the prepared request, research with the host's own tools, write decision.json with evidence and an explicit bull/bear debate, and let Python validate and settle. Use when the user asks for an investment decision or a clawock run request is present.
    ---
    
    # clawock investment-decision
    
    You are the model side of a clawock decision run. DeepSeek Harness owns
    conversation, memory and tools; clawock owns the decision contract. Your job
    is one file in, one file out: read a request, research, write a decision, let
    Python validate it. The model can never grade itself.
    
    ```
    prepare ──► request.json ──► you: research + write decision.json ──► publish ──► receipt
    (certified │                       (collect evidence,                │       (Python settles:
     context + │                        run the bull/bear debate,          │        evidence counts, debate
     gates)    │                        pick a bounded action)             │        links, money/FX to the cent)
               └───────────────────────────────────────────────────────────┘
    ```
    
    ## Prerequisites
    
    `clawock` must be installed (Python ≥ 3.11):
    
    ```bash
    python -m pip install clawock
    ```
    
    If a workspace is not initialized yet, create it **with the workflow pinned** —
    that flag is what turns `decision.json` into the enforced contract:
    
    ```bash
    clawock init ./book --workflow investment-decision
    clawock workflow install investment-decision --workspace ./book
    ```
    
    The second command copies the readable contract (including
    `references/decision-contract.md` and the JSON Schema) into
    `./book/.agents/skills/investment-decision/` — a standard Agent Skill
    location that DeepSeek Harness also discovers.
    
    ## The loop
    
    ### 1. Prepare
    
    ```bash
    clawock run prepare --workspace ./book
    ```
    
    Read the emitted request file (the `request_file` path printed on stdout,
    e.g. `.clawock/work/<run_id>/request.json`). It contains:
    
    - `task` — the decision contract (evidence, opposing case, bounded action,
      reconciled amounts)
    - `context.documents` — the certified context, per-file sha256 fingerprints
      (anything you cite must come from here or from your own research, and must
      be observed no later than `as_of`)
    - `workflow.parameters` — gates: `min_supporting_evidence`,
      `min_opposing_evidence`, `max_confidence_without_primary_source`
    
    ### 2. Research, then debate, then decide
    
    Research with the host's normal tools (web search, file reads, the live
    dashboard at <https://kcnyu.github.io/clawock/> as `source_class: market`
    evidence). Collect **both** sides on purpose — the workflow has an opposing
    minimum, and `publish` refuses a decision whose bear case is a strawman:
    
    1. Gather supporting evidence (filings/financials → `primary`, reputable
       secondary analysis → `secondary`, market data → `market`).
    2. Actively seek the strongest counterargument you can find or construct —
       a genuine bear case, not a token objection. Record it as `opposing`
       evidence.
    3. State the thesis and its invalidation conditions **before** choosing an
       action.
    4. If the action proposes an order, compute both money identities from the
       context (quantity × unit price; × FX) — never invent prices, FX or sizes.
    
    Write `decision.json` at the workspace root — artifact paths are resolved
    against the workspace root, not the request directory:
    
    ```json
    {
      "schema_version": 1,
      "workflow": {"id": "investment-decision", "version": "1.1.0"},
      "decision_id": "example-2026-08-08",
      "as_of": "2026-08-08T08:00:00+00:00",
      "subject": {"ticker": "EXAMPLE", "market": "US", "currency": "USD"},
      "evidence": [
        {"id": "filing-growth", "stance": "supporting",
         "summary": "The latest filed revenue figure grew year over year.",
         "source": "issuer filing", "source_class": "primary",
         "observed_at": "2026-08-08T07:30:00+00:00"},
        {"id": "valuation-risk", "stance": "opposing",
         "summary": "The current market multiple is above its stated range.",
         "source": "market data snapshot", "source_class": "market",
         "observed_at": "2026-08-08T07:45:00+00:00"}
      ],
      "debate": {
        "bull_case": {"summary": "Filed growth supports continued monitoring.",
                      "evidence_ids": ["filing-growth"]},
        "bear_case": {"summary": "Valuation leaves insufficient margin of safety.",
                      "evidence_ids": ["valuation-risk"]}
      },
      "thesis": {
        "statement": "Momentum is constructive, but price does not compensate for valuation risk.",
        "confidence": 0.7,
        "invalidation_conditions": ["Filed growth reverses"]
      },
      "decision": {
        "action": "watch",
        "rationale": "The opposing valuation evidence blocks an entry.",
        "evidence_ids": ["filing-growth", "valuation-risk"],
        "order": null
      }
    }
    ```
    
    Rules that are enforced by `clawock run publish`, not by this file:
    
    1. `debate.bull_case` and `debate.bear_case` are both required and each cites
       evidence; the bear case must cite opposing-stance evidence — publish
       refuses without it. Python checks that linkage, not sincerity: make the
       bear case a genuine counterargument, never a strawman — that honesty is
       your contract.
    2. Every `evidence` row needs a `stance` (`supporting` | `opposing` |
       `context`), a `source_class` (`primary` | `secondary` | `market` |
       `agent`) and an `observed_at` no later than `as_of`.
    3. All `evidence_ids` references must exist (decision and both debate cases);
       conclusions in `thesis.statement` and `decision.rationale` should be
       backed by cited evidence.
    4. If you propose an order, the currency amounts must reconcile to the cent;
       let the numbers come out of the context, never invent them.
    5. Confidence above `max_confidence_without_primary_source` requires a cited
       primary source.
    
    The sibling files next to this SKILL.md carry the full contract:
    `references/decision-contract.md` (with `assets/order.example.json`, an
    order-carrying decision whose two money identities reconcile). Introspect
    the exact artifact shape any time: `clawock workflow schema
    investment-decision decision.json`.
    
    ### 3. Publish and report
    
    ```bash
    clawock run publish \
      --workspace ./book \
      --request ./book/.clawock/work/<run_id>/request.json \
      --artifact decision.json=./book/decision.json
    ```
    
    Report the receipt's `status` and `run_id`, and if `status` is `published`,
    show the user a compact decision card:
    
    ```
    Subject      EXAMPLE (US/USD)          decision_id example-2026-08-08
    Bull         Filed growth supports continued monitoring.        [1 citing]
    Bear         Valuation leaves insufficient margin of safety.    [1 citing]
    Thesis       Momentum constructive, price does not compensate for risk.
    Confidence   0.70  ·  Action watch  ·  Invalidation: filed growth reverses
    Receipt      published  ·  run_id <run_id>  ·  certificate pinned
    ```
    
    Never edit the receipt, never re-grade the decision, never "improve" the
    artifact after publish — Python settles.
    
    ## Before publish: self-check
    
    Run this checklist before invoking `publish` — Python re-checks all of it
    anyway, but a clean first pass beats a rejected receipt:
    
    - both `debate.bull_case` and `debate.bear_case` present, each citing
      existing `evidence_ids`, the bear case citing `opposing` rows
    - every cited `evidence_id` exists; no duplicates
    - every evidence row has `stance`, `source`, `source_class`, and
      `observed_at` no later than `as_of`
    - one `primary` row is cited whenever `confidence` exceeds the cap
    - an order (if any) satisfies `gross_amount_quote = quantity × unit_price`
      and `gross_amount_base = gross_amount_quote × fx_quote_to_base`, to the
      cent
    
    ## If publish rejects
    
    The receipt lists `validation_issues` with `code` + `message`. Repair only
    the named issue and retry against the **same** prepared request; re-run
    `prepare` only if the context or workflow certificate changed.
    
    | typical `code` | meaning | fix |
    |---|---|---|
    | `unknown_fields` / `missing_fields` | a field name is wrong or extra | align with the JSON example above; no `reasoning`, no `opposing_case` |
    | `insufficient_supporting_evidence` / `insufficient_opposing_evidence` | gate minimums not met | add more evidence rows with that `stance` |
    | `unsupported_bear_case` / `unsupported_bull_case` | debate case cites the wrong stance | point `bear_case` at `opposing` rows, `bull_case` at `supporting` rows |
    | `missing_evidence_reference` | `evidence_ids` names an unknown row | only cite `id`s that exist in `evidence` |
    | `gross_amount_mismatch` / `fx_amount_mismatch` | order arithmetic wrong | recompute `quantity × unit_price` and `× fx_quote_to_base` to the cent |
    | `confidence_without_primary_source` | confidence above the cap, no primary cited | add a `primary` row and cite it in `decision.evidence_ids` |
    | `future_evidence` | `observed_at` after `as_of` | backdate or fix timestamps |
    
    ## Where things land
    
    | path | contents |
    |---|---|
    | `<workspace>/decision.json` | your artifact (read by publish) |
    | `<workspace>/.clawock/work/<run_id>/request.json` | the certified request |
    | `<workspace>/.clawock/runs/<run_id>/` | receipt + manifest (the settlement record) |
    
    ## Learn from outcomes
    
    After the stated horizon, record price/FX outcome evidence and run
    `clawock workflow evaluate investment-decision --decision ... --outcome ...`.
    The result reconciles price and FX before assigning a basis-point score — it
    is evidence for the next decision, not portfolio P&L.
    
    ## Record conversation verdicts
    
    A conversation verdict (加仓/减仓/建仓/清仓/观望) is a decision — write it
    to the shared decision-mind ledger, the same `memory/decisions.jsonl` the
    daily OpenClaw brief writes to, so both sides can read it and the daily
    settlement round-trips it:
    
    ```bash
    clawock record \
      --subject 00100 --market HK --currency HKD \
      --action reject --confidence 0.65 --driven-by fundamental \
      --bull "营收 +159% YoY,入通/海外霸榜催化" \
      --bear "净利率 -2368%,资不抵债,z+2.8σ 反转" \
      --thesis "高增长救不了资不抵债,先活下来" \
      --invalidation "站回 340" --invalidation "缩量企稳" \
      --emotion averaging_down --note "浮亏 -40% 的摊本冲动被压过,忍住没加"
    ```
    
    `--source` defaults to `conversation` for DSH; other harnesses pass their
    own — OpenClaw `--source openclaw`, Claude Code `--source claude`, Codex
    `--source codex`. One ledger, one record command, every harness calls it;
    nobody edits `decisions.jsonl` directly.
    
    Rules: the bear case and at least one observable invalidation condition are
    mandatory (the command rejects weak records); be honest about emotion
    pressure — `fomo`/`revenge`/`averaging_down` are the exact patterns this
    ledger exists to surface. Full schema (in the repository, not in the npm
    tarball):
    <https://github.com/KCNyu/clawock/blob/master/docs/decision-mind-ledger.md>
    
    ## Learn more
    
    Live proof on a real HK + US desk: <https://kcnyu.github.io/clawock/>
    The same contract from other harnesses (OpenClaw skill, Claude Code
    instruction, Codex AGENTS.md, pure CLI):
    <https://github.com/KCNyu/clawock/tree/master/examples/dsh/packages/clawock-dsh>

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related