Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 1 addition & 61 deletions .claude/rules/datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,74 +37,14 @@ updated: 2024-01-15T14:30:45Z # Use actual output from date command
---
```

### Implementation Instructions

1. **Before writing any file with frontmatter:**
- Run: `date -u +"%Y-%m-%dT%H:%M:%SZ"`
- Store the output
- Use this exact value in the frontmatter

2. **For commands that create files:**
- PRD creation: Use real date for `created` field
- Epic creation: Use real date for `created` field
- Task creation: Use real date for both `created` and `updated` fields
- Progress tracking: Use real date for `started` and `last_sync` fields

3. **For commands that update files:**
- Always update the `updated` field with current real datetime
- Preserve the original `created` field
- For sync operations, update `last_sync` with real datetime

### Examples

**Creating a new PRD:**
```bash
# First, get current datetime
CURRENT_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Output: 2024-01-15T14:30:45Z

# Then use in frontmatter:
---
name: user-authentication
description: User authentication and authorization system
status: backlog
created: 2024-01-15T14:30:45Z # Use the actual $CURRENT_DATE value
---
```

**Updating an existing task:**
```bash
# Get current datetime for update
UPDATE_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

# Update only the 'updated' field:
---
name: implement-login-api
status: in-progress
created: 2024-01-10T09:15:30Z # Keep original
updated: 2024-01-15T14:30:45Z # Use new $UPDATE_DATE value
---
```

### Important Notes

- **Never use placeholder dates** like `[Current ISO date/time]` or `YYYY-MM-DD`
- **Never estimate dates** - always get the actual system time
- **Always use UTC** (the `Z` suffix) for consistency across timezones
- **Preserve timezone consistency** - all dates in the system use UTC

### Cross-Platform Compatibility

If you need to ensure compatibility across different systems:

```bash
# Try primary method first
date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || \
# Fallback for systems without -u flag
date +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null
```

## Rule Priority
### Rule Priority

This rule has **HIGHEST PRIORITY** and must be followed by all commands that:
- Create new files with frontmatter
Expand Down
32 changes: 0 additions & 32 deletions .claude/rules/standard-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

This file defines common patterns that all commands should follow to maintain consistency and simplicity.

## Core Principles

1. **Fail Fast** - Check critical prerequisites, then proceed
2. **Trust the System** - Don't over-validate things that rarely fail
3. **Clear Errors** - When something fails, say exactly what and how to fix it
4. **Minimal Output** - Show what matters, skip decoration

## Standard Validations

### Minimal Preflight
Expand Down Expand Up @@ -144,31 +137,6 @@ Failed: auth.test.js (syntax error - line 42)
"This will delete 10 files. Continue? (yes/no)"
```

## Quick Reference

### Essential Tools Only
- Read/List operations: `Read, LS`
- File creation: `Read, Write, LS`
- GitHub operations: Add `Bash`
- Complex analysis: Add `Task` (sparingly)

### Status Indicators
- ✅ Success (use sparingly)
- ❌ Error (always with solution)
- ⚠️ Warning (only if action needed)
- No emoji for normal output

### Exit Strategies
- Success: Brief confirmation
- Failure: Clear error + exact fix
- Partial: Show what worked, what didn't

## Remember

**Simple is not simplistic** - We still handle errors properly, we just don't try to prevent every possible edge case. We trust that:
- The file system usually works
- GitHub CLI is usually authenticated
- Git repositories are usually valid
- Users know what they're doing

Focus on the happy path, fail gracefully when things go wrong.
53 changes: 1 addition & 52 deletions .claude/rules/use-ast-grep.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,6 @@ Use `ast-grep` (if installed) instead of plain regex or text search when:
- **Cross-language searches** are necessary (e.g., working with both Ruby and TypeScript in a monorepo)
- **Semantic code understanding** is important (e.g., finding patterns based on code structure, not just text)

## AST-Grep Command Patterns

### Basic Search Template:
```sh
ast-grep --pattern '$PATTERN' --lang $LANGUAGE $PATH
```

### Common Use Cases

- **Find function calls:**
`ast-grep --pattern 'functionName($$$)' --lang javascript .`
- **Find class definitions:**
`ast-grep --pattern 'class $NAME { $$$ }' --lang typescript .`
- **Find variable assignments:**
`ast-grep --pattern '$VAR = $$$' --lang ruby .`
- **Find import statements:**
`ast-grep --pattern 'import { $$$ } from "$MODULE"' --lang javascript .`
- **Find method calls on objects:**
`ast-grep --pattern '$OBJ.$METHOD($$$)' --lang typescript .`
- **Find React hooks:**
`ast-grep --pattern 'const [$STATE, $SETTER] = useState($$$)' --lang typescript .`
- **Find Ruby class definitions:**
`ast-grep --pattern 'class $NAME < $$$; $$$; end' --lang ruby .`

## Pattern Syntax Reference

- `$VAR` — matches any single node and captures it
- `$$$` — matches zero or more nodes (wildcard)
- `$$` — matches one or more nodes
- Literal code — matches exactly as written

## Supported Languages

- Rust, JavaScript, TypeScript, HTML, CSS, YAML, and JSON

## Integration Workflow

### Before using ast-grep:
Expand Down Expand Up @@ -77,23 +42,7 @@ When asked to "find all Ruby service objects that call `perform`":
- **read_file** for examining specific files found by ast-grep
- **edit_file** for making precise, context-aware code changes

### Advanced Usage
- **JSON output for programmatic processing:**
`ast-grep --pattern '$PATTERN' --lang $LANG $PATH --json`
- **Replace patterns:**
`ast-grep --pattern '$OLD_PATTERN' --rewrite '$NEW_PATTERN' --lang $LANG $PATH`
- **Interactive mode:**
`ast-grep --pattern '$PATTERN' --lang $LANG $PATH --interactive`

## Key Benefits Over Regex

1. **Language-aware** — understands syntax and semantics
2. **Structural matching** — finds patterns regardless of formatting
3. **Cross-language** — works consistently across different languages
4. **Precise refactoring** — makes structural changes safely
5. **Context-aware** — understands code hierarchy and scope

## Decision Matrix: When to Use Each Tool
### Decision Matrix: When to Use Each Tool

| Task Type | Tool Choice | Reason |
|--------------------------|----------------------|-------------------------------|
Expand Down
21 changes: 0 additions & 21 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

The current system is a Rust-first bounded Loop Engineer research/control plane plus a separately owned deterministic Rust trading runtime.

- Research: `rust_hft/alpha-harness/*`
- Prediction-market research and operator module: `rust_hft/prediction-markets`
- Data acquisition: `rust_hft/tools/collector`
- Runtime: `rust_hft/apps/live`
- Risk, OMS, and execution: `rust_hft/risk-control` and `rust_hft/execution-gateway`

Monday is one multi-venue trading system. Polymarket, Binance, OKX, and other
exchanges are venue Adapters at the existing market-data and execution seams;
they are not separate product authorities. `ploy-*` crate and binary names are
Expand All @@ -35,21 +29,6 @@ Read [README.md](README.md), [rust_hft/ARCHITECTURE.md](rust_hft/ARCHITECTURE.md
- Keep private signing keys and LLM credentials out of DuckDB and logs.
- Live-small activation remains fail-closed until every order path consumes envelope order-size and slippage limits.

## Focused Validation

Run from `rust_hft/`:

```bash
cargo test -p alpha-domain --locked
cargo test -p alpha-store --locked
cargo test -p alpha-engine --locked
cargo test -p alpha-harness --locked
cargo test -p hft-live --no-default-features --test deployment_envelope --locked
cargo clippy -p hft-collector --all-targets --features collector-binance --no-deps --locked -- -D warnings
```

Do not compile the entire workspace for ordinary changes. Run `cargo metadata --locked --no-deps` after workspace graph changes.

## Agent skills

### Issue tracker
Expand Down
14 changes: 7 additions & 7 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
environment:
CLICKHOUSE_DB: hft
CLICKHOUSE_USER: default
CLICKHOUSE_PASSWORD: ""
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:?set CLICKHOUSE_PASSWORD}
healthcheck:
test: ["CMD", "clickhouse-client", "--query", "SELECT 1"]
interval: 10s
Expand Down Expand Up @@ -90,8 +90,8 @@ services:

collector:
build:
context: ../rust_hft
dockerfile: ../deploy/Dockerfile.hft
context: ..
dockerfile: deploy/Dockerfile.hft
args:
- TARGET=collector
container_name: hft-collector
Expand Down Expand Up @@ -121,8 +121,8 @@ services:

trader:
build:
context: ../rust_hft
dockerfile: ../deploy/Dockerfile.hft
context: ..
dockerfile: deploy/Dockerfile.hft
args:
- TARGET=live
container_name: hft-trader
Expand Down Expand Up @@ -170,8 +170,8 @@ services:

paper-trader:
build:
context: ../rust_hft
dockerfile: ../deploy/Dockerfile.hft
context: ..
dockerfile: deploy/Dockerfile.hft
args:
- TARGET=paper
container_name: hft-paper
Expand Down
4 changes: 2 additions & 2 deletions deployment/aliyun/polymarket-market-tape-upload.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ OSS_BUCKET=monday-lob-apne1-1045353359
OSS_ENDPOINT=oss-ap-northeast-1-internal.aliyuncs.com
OSS_REGION=ap-northeast-1
ALIYUN_PROFILE=ecs-role
ZSTD_TIMEOUT_SECONDS=300
OSS_COPY_TIMEOUT_SECONDS=300
ZSTD_TIMEOUT_SECONDS=3600
OSS_COPY_TIMEOUT_SECONDS=1800
3 changes: 2 additions & 1 deletion deployment/aliyun/polymarket-market-tape-upload.service
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ StateDirectory=hft-collector
ReadWritePaths=/data/monday/spool/polymarket
RestrictAddressFamilies=AF_INET AF_INET6
UMask=0027
CPUQuota=30%
CPUQuota=200%
Nice=10
MemoryHigh=384M
MemoryMax=512M
Loading