init: seed framework reference content from agent-runtimes main repo
This commit is contained in:
84
harnesses/contexts/minimax-code-methodology/v1/CLAUDE.md
Normal file
84
harnesses/contexts/minimax-code-methodology/v1/CLAUDE.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Code Methodology (MiniMax)
|
||||
|
||||
## Rules (MUST follow — task fails if violated)
|
||||
|
||||
0. **NEVER use Write on existing files. Use Edit for ALL modifications to existing files.**
|
||||
- Read the file first (Read tool), then use Edit for targeted changes only.
|
||||
- Write is only for creating new files that do not yet exist.
|
||||
1. ONLY modify files directly related to your task. Do NOT touch other files.
|
||||
2. ONLY run the specific test file for your feature. NEVER run the full test suite.
|
||||
3. If something fails after 3 attempts with the same approach, try a COMPLETELY different approach.
|
||||
4. Do NOT create backup copies of files or directories.
|
||||
5. Do NOT rename existing files before modifying them.
|
||||
|
||||
## How to Work
|
||||
|
||||
1. Read the task description carefully.
|
||||
2. Read the files mentioned in the task.
|
||||
3. If a spec file is referenced, find the specific requirement by ID. Implement exactly that requirement.
|
||||
4. Look at an existing file similar to what you are creating. Copy its structure. Change only the parts specific to your task.
|
||||
5. Make changes in small steps.
|
||||
6. After each change, run ONLY your specific test file:
|
||||
|
||||
```bash
|
||||
python -m pytest tests/test_YOUR_FILE.py -v --tb=short -x
|
||||
```
|
||||
|
||||
WRONG (NEVER do this):
|
||||
```bash
|
||||
python -m pytest tests/ -v
|
||||
python -m pytest
|
||||
pytest
|
||||
```
|
||||
|
||||
7. If tests pass, write a summary and stop.
|
||||
|
||||
## When You Get Stuck
|
||||
|
||||
If the same error appears 3 times:
|
||||
- STOP trying the same fix.
|
||||
- Read the error message ONE more time.
|
||||
- Ask: "Am I looking at the right file?"
|
||||
- Ask: "Should I mock this instead of fixing it?"
|
||||
- Try the opposite approach.
|
||||
|
||||
If a directory or file does not exist where you expect it:
|
||||
- Do NOT debug the environment.
|
||||
- Mock it or create a test fixture instead.
|
||||
|
||||
## Python Conventions
|
||||
|
||||
- Python 3.12+ with type hints
|
||||
- Pydantic v2 for data models
|
||||
- pytest for testing
|
||||
- Structured JSON logging
|
||||
- Configuration via environment variables
|
||||
|
||||
## Python Safety Rules
|
||||
|
||||
### Module Imports
|
||||
Never call `sys.exit()` at module level or inside `except ImportError`. Use a flag:
|
||||
|
||||
```python
|
||||
_HAS_OPENAI = True
|
||||
try:
|
||||
import openai
|
||||
except ImportError:
|
||||
_HAS_OPENAI = False
|
||||
```
|
||||
|
||||
### Pydantic Validators
|
||||
- Use `@model_validator(mode='after')` for cross-field validation
|
||||
- `@field_validator` does NOT fire for default values
|
||||
|
||||
### Async Tests
|
||||
- Async test functions must be `async def` with `@pytest.mark.asyncio`
|
||||
- A sync `def test_` that calls async code silently passes without executing
|
||||
|
||||
## Session Logging
|
||||
|
||||
Write a brief session log to `/project/memory/log/<date>.<time>.md` with:
|
||||
- **Summary**: One paragraph
|
||||
- **Gotchas**: Issues with topic tags (e.g., `[python]`)
|
||||
|
||||
Omit empty sections. Keep it short.
|
||||
12
harnesses/contexts/minimax-code-methodology/v1/harness.yaml
Normal file
12
harnesses/contexts/minimax-code-methodology/v1/harness.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
kind: context
|
||||
name: minimax-code-methodology
|
||||
version: 1
|
||||
description: "MiniMax-specific coding methodology: directive style, anti-loop, test scope enforcement"
|
||||
requires: []
|
||||
provides: [coding-agent]
|
||||
|
||||
context_files:
|
||||
- source: ./CLAUDE.md
|
||||
target: /opt/harness/context/minimax-code-methodology/CLAUDE.md
|
||||
- source: ./run-tests.sh
|
||||
target: /opt/harness/context/minimax-code-methodology/run-tests.sh
|
||||
32
harnesses/contexts/minimax-code-methodology/v1/run-tests.sh
Executable file
32
harnesses/contexts/minimax-code-methodology/v1/run-tests.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Test scope enforcement for MiniMax agents.
|
||||
# Prevents running the full test suite — only allows specific test files.
|
||||
# Usage: ./run-tests.sh tests/test_my_feature.py
|
||||
set -euo pipefail
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "ERROR: Specify a test file. Usage: ./run-tests.sh tests/test_YOUR_FILE.py" >&2
|
||||
echo "Do NOT run the full test suite." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEST_PATH="$1"
|
||||
shift
|
||||
|
||||
# Block full-suite patterns
|
||||
case "$TEST_PATH" in
|
||||
tests/|tests|.)
|
||||
echo "ERROR: Running the full test suite is not allowed." >&2
|
||||
echo "Specify a single test file: ./run-tests.sh tests/test_YOUR_FILE.py" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Must be a .py file in tests/
|
||||
if [[ ! "$TEST_PATH" =~ ^tests/test_.*\.py$ ]]; then
|
||||
echo "ERROR: Test path must match tests/test_*.py (got: $TEST_PATH)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running: python -m pytest $TEST_PATH -v --tb=short -x $*"
|
||||
exec python -m pytest "$TEST_PATH" -v --tb=short -x "$@"
|
||||
Reference in New Issue
Block a user