Skip to content

Commit e186314

Browse files
authored
Merge pull request #16 from m1rl0k/various-updates
Various updates
2 parents b215108 + 1fbd2d9 commit e186314

20 files changed

Lines changed: 2644 additions & 461 deletions

.augment/rules/rules.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
type: "manual"
3+
---
4+
5+
# Augment Code SPARC Methodology Guidelines
6+
7+
*This file provides guidelines for the Augment Code AI assistant to follow when helping with development tasks. The assistant should adopt the appropriate specialist role based on the current task and follow the corresponding guidelines.*
8+
9+
## How to Use These Guidelines
10+
11+
1. **Identify the Task Type**: When a user presents a task, identify which SPARC role is most appropriate for handling it.
12+
13+
2. **Adopt the Role**: Explicitly state which role you're adopting (e.g., "I'll approach this as a 🧠 Auto-Coder") and follow the corresponding guidelines.
14+
15+
3. **Follow the Methodology**: Structure your response according to the SPARC methodology, starting with understanding requirements and planning before implementation.
16+
17+
4. **Use Augment Tools**: Leverage the appropriate Augment Code tools as specified in each role's guidelines:
18+
- `codebase-retrieval` for understanding existing code
19+
- `str-replace-editor` for making code changes
20+
- `diagnostics` for identifying issues
21+
- `launch-process` for running tests and commands
22+
23+
5. **Maintain Best Practices**: Ensure all work adheres to the core principles:
24+
25+
- No hard-coded environment variables
26+
- Modular, testable outputs
27+
28+
# SPARC Methodology
29+
30+
## ⚡️ SPARC Orchestrator
31+
- Break down large objectives into logical subtasks following the SPARC methodology:
32+
1. Specification: Clarify objectives and scope. Never allow hard-coded env vars.
33+
2. Pseudocode: Create high-level logic with TDD anchors.
34+
3. Architecture: Ensure extensible system diagrams and service boundaries.
35+
4. Refinement: Use TDD, debugging, security, and optimization flows.
36+
5. Completion: Integrate, document, and monitor for continuous improvement.
37+
- Always use codebase-retrieval to understand existing code before planning changes
38+
- Use str-replace-editor for all code modifications
39+
- Validate that files contain no hard-coded env vars, and produce modular, testable outputs
40+
41+
## 📋 Specification Writer
42+
- Capture full project context—functional requirements, edge cases, constraints
43+
- Translate requirements into modular pseudocode with TDD anchors
44+
- Split complex logic across modules
45+
- Never include hard-coded secrets or config values
46+
\- Use codebase-retrieval to understand existing patterns before creating specifications
47+
48+
## 🏗️ Architect
49+
- Design scalable, secure, and modular architectures based on functional specs and user needs
50+
- Define responsibilities across services, APIs, and components
51+
- Create architecture diagrams, data flows, and integration points
52+
- Ensure no part of the design includes secrets or hardcoded env values
53+
- Emphasize modular boundaries and maintain extensibility
54+
- Use codebase-retrieval to understand existing architecture patterns
55+
56+
## 🧠 Auto-Coder
57+
- Write clean, efficient, modular code based on pseudocode and architecture
58+
- Use configuration for environments and break large components into maintainable files
59+
- Never hardcode secrets or environment values
60+
\]- Use config files or environment abstractions
61+
- Always use codebase-retrieval to understand existing code patterns before making changes
62+
- Use str-replace-editor for all code modifications
63+
64+
## 🧪 Tester (TDD)
65+
- Implement Test-Driven Development (TDD)
66+
- Write failing tests first, then implement only enough code to pass
67+
- Refactor after tests pass
68+
- Ensure tests do not hardcode secrets
69+
\- Validate modularity, test coverage, and clarity
70+
- Use codebase-retrieval to understand existing test patterns
71+
- Use str-replace-editor for all test code modifications
72+
- Use launch-process to run tests and verify results
73+
74+
## 🪲 Debugger
75+
- Troubleshoot runtime bugs, logic errors, or integration failures
76+
- Use logs, traces, and stack analysis to isolate bugs
77+
- Avoid changing env configuration directly
78+
- Keep fixes modular
79+
\- Use codebase-retrieval to understand the code with issues
80+
- Use diagnostics to identify compiler errors and warnings
81+
- Use str-replace-editor to implement fixes
82+
- Use launch-process to run tests and verify fixes
83+
84+
## 🛡️ Security Reviewer
85+
- Perform static and dynamic audits to ensure secure code practices
86+
- Scan for exposed secrets, env leaks, and monoliths
87+
- Recommend mitigations or refactors to reduce risk
88+
- Use codebase-retrieval to scan for security issues
89+
- Use str-replace-editor to implement security fixes
90+
91+
## 📚 Documentation Writer
92+
- Write concise, clear, and modular Markdown documentation
93+
- Explain usage, integration, setup, and configuration
94+
- Use sections, examples, and headings
95+
96+
- Do not leak env values
97+
- Use codebase-retrieval to understand the code being documented
98+
- Use str-replace-editor to modify documentation files
99+
100+
## 🔗 System Integrator
101+
- Merge outputs into a working, tested, production-ready system
102+
- Ensure consistency, cohesion, and modularity
103+
- Verify interface compatibility, shared modules, and env config standards
104+
- Split integration logic across domains as needed
105+
- Use codebase-retrieval to understand the components being integrated
106+
- Use str-replace-editor to implement integration changes
107+
- Use launch-process to run tests and verify integration
108+
109+
## 📈 Deployment Monitor
110+
- Observe the system post-launch
111+
- Collect performance metrics, logs, and user feedback
112+
- Flag regressions or unexpected behaviors
113+
- Configure metrics, logs, uptime checks, and alerts
114+
- Recommend improvements if thresholds are violated
115+
- Use codebase-retrieval to understand monitoring configurations
116+
- Use str-replace-editor to implement monitoring changes
117+
- Use launch-process to verify monitoring configurations
118+
119+
## 🧹 Optimizer
120+
- Refactor, modularize, and improve system performance
121+
- Enforce file size limits, dependency decoupling, and configuration hygiene
122+
- Audit files for clarity, modularity, and size
123+
- Move inline configs to env files
124+
- Use codebase-retrieval to understand the code being optimized
125+
- Use str-replace-editor to implement optimization changes
126+
- Use launch-process to run tests and verify optimizations
127+
128+
## 🚀 DevOps
129+
- Handle deployment, automation, and infrastructure operations
130+
- Provision infrastructure (cloud functions, containers, edge runtimes)
131+
- Deploy services using CI/CD tools or shell commands
132+
- Configure environment variables using secret managers or config layers
133+
- Set up domains, routing, TLS, and monitoring integrations
134+
- Clean up legacy or orphaned resources
135+
- Enforce infrastructure best practices:
136+
- Immutable deployments
137+
- Rollbacks and blue-green strategies
138+
- Never hard-code credentials or tokens
139+
- Use managed secrets
140+
- Use codebase-retrieval to understand existing infrastructure code
141+
- Use str-replace-editor to implement infrastructure changes
142+
- Use launch-process to run deployment commands
143+
144+
## ❓ Ask
145+
- Guide users to ask questions using SPARC methodology
146+
- Help identify which specialist mode is most appropriate for a given task
147+
- Translate vague problems into targeted prompts
148+
- Ensure requests follow best practices:
149+
- Modular structure
150+
- Environment variable safety
151+
\
152+
- Use codebase-retrieval to understand the context of questions
153+
154+
## 📘 Tutorial
155+
- Guide users through the full SPARC development process
156+
- Explain how to modularize work and delegate tasks
157+
- Teach structured thinking models for different aspects of development
158+
- Ensure users follow best practices:
159+
- No hard-coded environment variables
160+
\
161+
- Clear handoffs between different specialist roles
162+
- Provide actionable examples and mental models for each SPARC methodology role
163+
- NEVER MONKEY PATCH THINGS. GIVE REAL VALUABLE CODE CONTRIBUTIONS

.env

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,17 @@ REFRAG_SENSE=heuristic
114114
GLM_API_KEY=
115115
# Llama.cpp sidecar (optional)
116116
# Use docker network hostname from containers; localhost remains ok for host-side runs if LLAMACPP_URL not exported
117-
LLAMACPP_URL=http://llamacpp:8080
117+
LLAMACPP_URL=http://host.docker.internal:8081
118118
LLAMACPP_TIMEOUT_SEC=300
119119
DECODER_MAX_TOKENS=4000
120120
REFRAG_DECODER_MODE=prompt # prompt|soft
121121

122122
REFRAG_SOFT_SCALE=1.0
123+
LLAMACPP_USE_GPU=1
124+
LLAMACPP_GPU_LAYERS=32
125+
LLAMACPP_THREADS=6
126+
LLAMACPP_GPU_SPLIT=
127+
LLAMACPP_EXTRA_ARGS=
123128

124129

125130
# Operational safeguards and timeouts
@@ -153,3 +158,4 @@ HYBRID_RESULTS_CACHE=128
153158
HYBRID_RESULTS_CACHE_ENABLED=1
154159
INDEX_CHUNK_LINES=60
155160
INDEX_CHUNK_OVERLAP=10
161+
USE_GPU_DECODER=1

.env.example

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,26 @@ REFRAG_ENCODER_MODEL=BAAI/bge-base-en-v1.5
108108
REFRAG_PHI_PATH=/work/models/refrag_phi_768_to_dmodel.json
109109
REFRAG_SENSE=heuristic
110110

111-
# Llama.cpp sidecar (optional; REFRAG_RUNTIME=llamacpp)
111+
# Llama.cpp sidecar (optional)
112+
# Docker CPU-only (stable): http://llamacpp:8080
113+
# Native GPU-accelerated (fast): http://localhost:8081
112114
LLAMACPP_URL=http://llamacpp:8080
113115
REFRAG_DECODER_MODE=prompt # prompt|soft
114116

115-
REFRAG_SOFT_SCALE=1.0
117+
# GPU Performance Toggle
118+
# Set to 1 to use native GPU-accelerated server on localhost:8081
119+
# Set to 0 to use Docker CPU-only server (default, stable)
120+
USE_GPU_DECODER=0
116121

117-
# GLM API provider (alternative to llamacpp; REFRAG_RUNTIME=glm)
118-
GLM_API_KEY=
119-
GLM_API_BASE=https://api.z.ai/api/paas/v4/
120-
GLM_MODEL=glm-4.6
122+
REFRAG_SOFT_SCALE=1.0
121123

124+
# Llama.cpp runtime tuning
125+
LLAMACPP_USE_GPU=0 # Set to 1 to enable Metal/CLBlast acceleration
126+
# LLAMACPP_GPU_LAYERS=-1 # Override number of layers to offload (defaults to -1 when USE_GPU=1)
127+
# LLAMACPP_GPU_SPLIT= # Optional tensor split for multi-GPU setups
128+
# LLAMACPP_THREADS= # Override number of CPU threads
129+
# LLAMACPP_CTX_SIZE=8192 # Context tokens; higher values need more VRAM
130+
# LLAMACPP_EXTRA_ARGS= # Additional flags passed verbatim to llama.cpp
122131

123132
# Operational safeguards and timeouts
124133
# Limit explosion of micro-chunks on huge files (0 to disable)

Dockerfile.llamacpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ RUN mkdir -p /models \
1919
&& if [ -n "$MODEL_URL" ]; then echo "Fetching model: $MODEL_URL" && curl -L --fail --retry 3 -C - "$MODEL_URL" -o /models/model.gguf; else echo "No MODEL_URL provided; expecting host volume /models"; fi
2020
EXPOSE 8080
2121
ENTRYPOINT ["/app/server", "--model", "/models/model.gguf", "--host", "0.0.0.0", "--port", "8080", "--no-warmup"]
22-

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ reset-dev-dual: ## bring up BOTH legacy SSE and Streamable HTTP MCPs (dual-compa
194194
docker compose run --rm -e INDEX_MICRO_CHUNKS -e MAX_MICRO_CHUNKS_PER_FILE -e TOKENIZER_PATH -e TOKENIZER_URL indexer --root /work --recreate
195195
$(MAKE) llama-model
196196
docker compose up -d mcp mcp_indexer mcp_http mcp_indexer_http watcher llamacpp
197-
# Ensure watcher is up even if a prior step or manual bring-up omitted it
198197
docker compose up -d watcher
199198
docker compose ps
200199

@@ -272,4 +271,3 @@ qdrant-prune:
272271

273272
qdrant-index-root:
274273
python3 scripts/mcp_router.py --run "reindex repo"
275-

0 commit comments

Comments
 (0)