ReMe/plugins/auto-fin/README.md
jinliyl 99afc2604f
Some checks are pending
CI / Documentation / Test and build documentation (push) Waiting to run
CI / Python packages / Build and verify distributions (push) Waiting to run
CI / Python quality / Pre-commit (push) Waiting to run
CI / Python tests / Unit Tests - py3.11 (push) Waiting to run
CI / Python tests / Unit Tests - py3.12 (push) Waiting to run
CI / Python tests / Unit Tests - py3.13 (push) Waiting to run
CI / ReMe Studio / Studio checks (push) Waiting to run
CI / TypeScript integrations / Type-check, test, and pack (push) Waiting to run
CI / Windows / CLI smoke - py3.11 (push) Waiting to run
Deploy / Documentation / deploy (push) Blocked by required conditions
Deploy / Documentation / Build documentation (push) Waiting to run
Security / CodeQL / Analyze javascript-typescript (push) Waiting to run
Security / CodeQL / Analyze python (push) Waiting to run
fix(release): harden embedding store and plugins for ReMe 0.4.1.9 (#503)
* chore(release): prepare ReMe 0.4.1.9

* refactor(config): remove daily_cookbook and streamline plugin configs

- Delete the entire daily_cookbook.yaml standalone application config
- Remove qwenpaw dependencies verification and related CI workflow steps
- Simplify release workflows by removing qwenpaw verification and enforcing reme-ai >=0.4.1.9
- Update plugin start commands and examples to use 'default' or 'demo' configs instead of daily_cookbook
- Adjust imports and tests related to daily_cookbook removal and injected_job_kwargs enhancements
- Refactor agent wrapper to support injected_job_kwargs for job parameter injection in auto-fin and daily-paper
- Improve daily_paper digest prompt to include configured daily directory and correct historical search constraints
- Update dependency versions in pyproject.toml files to require reme-ai >=0.4.1.9 and remove qwenpaw optional dependencies
- Clean up unused environment variables and obsolete test cases related to daily_cookbook and verification steps

* fix(local_embedding_store): retry batch computation on vector space changes

- Add up to 3 attempts to recompute embedding batch if vector space changes during processing
- Log warnings when maximum retries reached and discard stale results
- Prevent caching results from outdated vector spaces to maintain consistency
- Add tests to verify retry behavior and abort after continuous vector space churn

fix(daily_paper): update digest search logic and tests

- Change search to query existing memory, not only previous articles in daily_dir
- Allow multiple searches outside daily_dir but limit links to dated markdown in daily_dir before today
- Update test assertions to reflect revised search and linking rules

* fix(embedding): retry vector space changes per request
2026-08-28 11:35:04 +08:00

126 lines
5.1 KiB
Markdown

# Auto Fin Plugin
[中文](README_ZH.md)
Auto Fin fetches a rolling window of CLS telegraph news (24 hours by default), selects items related to configured
topics, searches ReMe for useful historical context, and writes one Chinese Markdown report with validated wikilinks.
Current news and topic selection stay in runtime memory; only the final report becomes durable memory. This directory
is an independent Python distribution. Its single `reme.plugins` entry point exposes a `plugin.yaml` containing the
three Step backends and their Job configuration under `application_defaults`. Enable the installed plugin explicitly
through `plugins=["auto-fin"]`.
> Auto Fin has no reliable market-price feed. It does not calculate returns, targets, or entry points and is not
> investment advice.
## Quick start
### 1. Install ReMe and Auto Fin
```bash
python -m pip install "reme-ai[core]>=0.4.1.9"
reme plugins install reme-auto-fin
```
### 2. Configure the model environment
Configure the LLM environment variables as described in the
[ReMe model-configuration guide](../../README.md#optional-model-configuration). Other compatible models and providers
can also be used.
### 3. Start ReMe with the plugin
```bash
reme start plugins='["auto-fin"]'
```
With no explicit `config`, ReMe loads `default.yaml` and adds the plugin to that service.
From another terminal, call the running HTTP service through ReMe's CLI client:
```bash
reme auto_fin topics="黄金,AI,存储芯片"
```
Or call its HTTP endpoint directly:
```bash
curl -s http://127.0.0.1:2333/auto_fin \
-H 'Content-Type: application/json' \
-d '{"topics":"黄金,AI,存储芯片"}'
```
The HTTP service also exposes the same Job as the `auto_fin` MCP tool at `/mcp`. The default topics are
`黄金,机器人,半导体`; an empty value also uses these defaults.
To host the application with both JSON and MCP access:
```bash
reme start plugins='["auto-fin"]' \
service.backend=http
```
Custom application configs must provide `agent_wrapper.default` and the `search` and `read` Jobs used by Auto Fin.
## Pipeline
```text
CLS public telegraph endpoint (rolling 24 hours)
normalize and deduplicate in RuntimeContext
topic Agent selects real news IDs in bounded batches
research Agent uses search + read on historical memory
validate historical wikilinks in code
daily/YYYY-MM-DD/auto_fin.md
```
`auto_fin_data_step` signs and paginates the same endpoint used by the CLS website. It starts at the decision time and
stops only after covering the exact preceding 24 hours. Requests are rate-limited and retried; malformed records and
records outside the window are discarded.
`auto_fin_topic_step` receives batches of current news and returns only related `news_id` values. Code ignores unknown
IDs and deduplicates repeated IDs, then preserves the source-news order. If nothing is relevant, the job succeeds as a
skip without writing or sending a report.
`auto_fin_merge_step` receives only selected current news. It exposes `search` and `read`, and keeps current CLS IDs,
times, and titles as plain evidence. The prompt limits
wikilinks to historical Markdown actually used by the Agent; the code-level boundary independently keeps only existing,
workspace-relative Markdown targets. Missing, absolute, escaping, backslash, and self-referential targets are degraded
to their readable aliases.
Same-day reruns use the existing report as context and replace it with the revised result. The final write is atomic and
refreshes the daily index. No JSONL, intermediate Markdown, or structured Agent output is written.
## Parameters
| Parameter | Default | Purpose |
|--------------------|-----------------------:|--------------------------------------------------------------------------|
| `date` | `""` | Empty uses today in Shanghai; an explicit value must equal today |
| `now` | `""` | Optional ISO 8601 decision time for testing or replay |
| `topics` | `"黄金,机器人,半导体"` | Comma-separated topics; empty also uses these defaults |
| `window_hours` | `24` | Rolling number of hours of CLS telegraph news to fetch; must be positive |
| `request_interval` | `10` | Minimum delay in seconds after every CLS request attempt; may be zero |
| `max_retries` | `3` | Maximum attempts for each CLS page request; must be at least one |
The plugin cron Job starts with the application and runs daily at 18:00 in the application timezone.
## Output
```text
.reme/daily/YYYY-MM-DD/auto_fin.md
```
The report includes a title, description, current CLS evidence, historical analysis, contextual wikilinks, and a fixed
non-investment disclaimer. Network errors and invalid Agent output fail explicitly; no relevant current news is a
successful skip.
## Validation
```bash
python -m pytest plugins/auto-fin -v
```
Unit tests mock the CLS and Agent boundaries and do not contact external services.