ForgeCore Graphical is an interactive TUI (Terminal User Interface) app and CLI tool that uses dual LLM agents (Qwen 2.5 Coder + DeepSeek Coder) to generate, modify, and validate code with 22 safety layers.
Run the professional TUI app:
python tui.pyOr use the shortcut:
python forge.pyExecute a specific task directly:
python tui.py task "Add a factorial function to math_utils.py"- 🤖 Dual-Agent System: Planner (Qwen) + Critic (DeepSeek) work together
- 🧠 Advanced Reasoning: Full "Thinking" and "Planning" phases before code is generated
- 🔒 22 Safety Layers: Tier enforcement, symbol validation, call graph analysis, etc.
- 🌍 Language-Agnostic: C++, Python, JavaScript, TypeScript, Rust, Go, Java, C#
- 💬 Interactive CLI: Start once, run multiple tasks
- 👁️ Real-Time Feedback: See what's being created/modified
- 📊 Diff Preview: Review changes before approval
- 🔄 Smart Rollback: Automatic rollback on validation failure
- Python 3.8+
- Ollama with models:
ollama pull qwen2.5-coder:7b-instruct ollama pull deepseek-coder:6.7b-instruct
git clone <repo-url>
cd ForgeCore
pip install -r requirements.txtFor detailed instructions on setting up and customizing local and remote LLM providers (Ollama, Groq, etc.), see the LLM Provider Guide.
python forge.py [project_path]Then use natural language:
forge> create a tic-tac-toe game in C++
forge> add a factorial function
forge> create file utils.cpp with helper functions
forge> ls
forge> cat main.cpp
forge> exit
python cli.py task "add a function to calculate fibonacci"<task>- Execute a task (natural language)ls/list- List files in projecttree- Show project structurecat <file>- View file contentstatus- Show system statushistory- Show task historyhelp- Show helpexit/quit- Exit
ForgeCore/
├── core/ # Core system
│ ├── planner.py # AI Planner (Qwen 2.5 Coder 7B)
│ ├── critic.py # AI Critic (DeepSeek Coder 6.7B)
│ ├── controller.py # Main execution engine
│ ├── context_manager.py # Smart context & history management
│ ├── indexer.py # Project indexing (SQLite)
│ ├── snapshot.py # Rollback & backup system
│ └── ...
├── tools/ # Validation & environment tools
│ ├── smart_validator.py # Language-agnostic build/syntax checker
│ ├── language_detector.py # Automatic file type detection
│ └── ...
├── policy/ # Safety & tier policies
│ ├── invariants.json # Global system constraints
│ └── tier_policy.json # File access & modification tiers
├── memory/ # Persistence layer
│ └── forgecore.db # SQLite database for indexing
├── forge.py # Interactive CLI (Stateful)
└── cli.py # Single-task CLI (Stateless)
ForgeCore implements a comprehensive 22-layer safety stack:
- Operation Support: Validates if the requested action is supported.
- File Indexing: Ensures target files are tracked and valid.
- Symbol Duplication: Prevents duplicate definitions before writing.
- Critic Intent Review: Dual-agent review of the plan before execution.
- Rewrite Ratio (Per-File): Prevents excessive modification of single files.
- Rewrite Ratio (Cross-File): Limits total project-wide changes.
- Line Limit: Caps the size of generated content.
- File Count Limit: Prevents accidental massive refactors.
- Path Traversal: Blocks access outside the project root.
- File Integrity Guard: Ensures files haven't changed during execution.
- Tier Enforcement: Protects core/system files from AI modification.
- Build System Warnings: Alerts on changes to critical configuration files.
- Type Safety: Basic type check for common languages.
- Data Flow Analysis: Detects uninitialized variables or use-before-def.
- Resource Tracking: Identifies potential memory leaks or null pointers.
- Invariant Checking: Prevents division by zero or array bounds errors.
- Effect Tracking: Monitors side effects in pure functions.
- Build Validation: Language-agnostic syntax/compilation check.
- Module Integrity: Verifies file-level dependencies.
- Symbol Validation: Cross-file symbol resolution check.
- Call Graph Integrity: Detects illegal cycles or recursions.
- Final Critic Review: Post-execution review of the actual result.
$ python forge.py D:\myproject
======================================================================
FORGECORE - INTERACTIVE MODE
======================================================================
Project: D:\myproject
[INFO] Empty project detected - ready to build from scratch!
[OK] System ready!
forge> create a complete tic-tac-toe game in C++
🤖 AI is planning...
✓ Plan generated!
Operation: CREATE_FILE
Target File: tic_tac_toe.cpp
📄 DIFF PREVIEW (new file):
+ 1 | #include <iostream>
+ 2 | #include <vector>
...
Approve this plan? (y/n/m for modify): y
[Executing...]
TASK COMPLETE
Status: completed
[OK] Task completed successfully!
Changes made:
[+] Created: tic_tac_toe.cpp
forge> ls
Total files: 1
tic_tac_toe.cpp 2049 bytes
forge> exit
Goodbye!Create forgecore_config.json:
{
"project_path": "D:\\path\\to\\your\\project"
}Or use command line:
python cli.py configpython cli.py test- User gives task in natural language
- Planner (Qwen) generates PatchIntent
- Critic (DeepSeek) reviews intent (pre-execution)
- User approves after seeing diff preview
- Controller executes with 22 safety checks
- Validation runs (build, symbols, call graph, etc.)
- Critic reviews result (post-execution)
- Success or rollback based on validation
- Language: Python 3.8+
- LLMs: Qwen 2.5 Coder 7B, DeepSeek Coder 6.7B
- Database: SQLite (for indexing)
- Architecture: State machine with transaction context
MIT
Contributions welcome! Please ensure all 46 tests pass:
python cli.py test✅ Production-ready ✅ 100% test coverage (46/46 tests) ✅ All safety layers active ✅ Dual-agent system operational