The Raw CLI (AGISystem2Raw.sh) provides direct access to the AGISystem2 engine through structured Sys2DSL commands. It is designed for automation, testing, and scripting scenarios where determinism and precise control are essential. Unlike the Chat Interface, it requires no external LLM dependencies and executes commands exactly as specified.
The Raw CLI passes structured Sys2DSL commands directly to the parser, which feeds the AGISystem2 engine. Output is deterministic and can be formatted as JSON for programmatic consumption.
The Raw CLI requires only:
No external API keys or network access required. The engine runs entirely locally.
# Start interactive REPL ./bin/AGISystem2Raw.sh # The prompt appears: AGIS2>
# Execute single command ./bin/AGISystem2Raw.sh --exec "add Dog IS_A Animal" # Execute with JSON output ./bin/AGISystem2Raw.sh --exec "ask Is Dog an Animal?" --json # Execute multiple commands from file ./bin/AGISystem2Raw.sh --batch commands.sys2dsl # Pipe commands via stdin echo "add Cat IS_A Animal" | ./bin/AGISystem2Raw.sh --batch -
Commands follow the Sys2DSL syntax. The full reference is in the Syntax Guide.
# Basic fact assertion AGIS2> add Dog IS_A Animal OK: ASSERT Dog IS_A Animal # With explicit ASSERT keyword AGIS2> ASSERT Cat IS_A Mammal OK: ASSERT Cat IS_A Mammal # Multiple relations AGIS2> add Fire CAUSES Smoke AGIS2> add Fire CAUSES Heat AGIS2> add Water EXTINGUISHES Fire
# Yes/no question AGIS2> ask Is Dog an Animal? Result: TRUE_CERTAIN Confidence: 0.95 # What-type question AGIS2> ask What is Dog? Result: Animal, Mammal # Structured query AGIS2> ASK "Dog IS_A ?" Result: Animal
# List all facts AGIS2> list facts # List concepts AGIS2> list concepts # Match pattern AGIS2> match ? IS_A Animal Dog IS_A Animal Cat IS_A Animal
The Raw CLI supports the full theory stack operations:
# Push new theory layer
AGIS2> THEORY_PUSH name="medical_context"
OK: Pushed theory layer "medical_context"
# Check current stack
AGIS2> LIST_THEORIES
{ "depth": 1, "name": "medical_context" }
# Add facts to current layer
AGIS2> add Aspirin REDUCES Inflammation
# Pop layer (discards facts added in that layer)
AGIS2> THEORY_POP
OK: Popped theory layer "medical_context"
# Save theory to file
AGIS2> SAVE_THEORY medical_knowledge
Saved to .AGISystem2/theories/medical_knowledge.sys2dsl
# Load theory from file
AGIS2> LOAD_THEORY medical_knowledge
Loaded 15 facts from medical_knowledge.sys2dsl
$ ./bin/AGISystem2Raw.sh --exec "ask Is Dog an Animal?" Result: TRUE_CERTAIN Confidence: 0.95 Reasoning: Direct inclusion in concept "Animal"
$ ./bin/AGISystem2Raw.sh --exec "ask Is Dog an Animal?" --json
{
"success": true,
"result": {
"truth": "TRUE_CERTAIN",
"confidence": 0.95,
"reasoning": [
{ "step": "inclusion_check", "concept": "Animal", "result": "inside" }
]
}
}
Commands can use variable bindings for complex operations:
# Store result in variable AGIS2> @result ASK "Dog IS_A ?" # Use variable in subsequent command AGIS2> @facts FACTS_MATCHING Dog ? ? # Chain operations AGIS2> @f ASSERT Bird IS_A Animal AGIS2> @q ASK "Bird IS_A Animal?" AGIS2> echo @q.truth TRUE_CERTAIN
Batch files (.sys2dsl) contain one command per line:
# comments.sys2dsl - Example batch file # Lines starting with # are comments # Define taxonomy ASSERT Dog IS_A Mammal ASSERT Cat IS_A Mammal ASSERT Mammal IS_A Animal ASSERT Bird IS_A Animal # Define properties ASSERT Dog HAS_PROPERTY barks ASSERT Cat HAS_PROPERTY meows ASSERT Bird HAS_PROPERTY flies # Define relations ASSERT Fire CAUSES Smoke ASSERT Water EXTINGUISHES Fire
Execute with:
./bin/AGISystem2Raw.sh --batch comments.sys2dsl
| Code | Meaning |
|---|---|
0 | Success |
1 | General error |
2 | Parse error (invalid syntax) |
3 | File not found (batch mode) |
4 | Query returned FALSE |
Exit codes allow integration with shell scripts and CI pipelines:
#!/bin/bash ./bin/AGISystem2Raw.sh --exec "ask Is system consistent?" --json if [ $? -eq 0 ]; then echo "System is consistent" else echo "Inconsistency detected" exit 1 fi
| Variable | Description | Default |
|---|---|---|
AGIS2_PROFILE | Configuration profile | manual_test |
AGIS2_DATA_DIR | Data directory path | .AGISystem2/data |
AGIS2_DEBUG | Enable debug output | 0 |
# .github/workflows/knowledge-test.yml
- name: Test knowledge consistency
run: |
./bin/AGISystem2Raw.sh --batch tests/rules.sys2dsl
./bin/AGISystem2Raw.sh --exec "ask Is system consistent?" --json
#!/bin/bash # load-and-query.sh # Load base knowledge ./bin/AGISystem2Raw.sh --batch base_knowledge.sys2dsl # Query specific facts result=$(./bin/AGISystem2Raw.sh --exec "ask $1?" --json) echo "$result" | jq '.result.truth'
const { execSync } = require('child_process');
function query(question) {
const result = execSync(
`./bin/AGISystem2Raw.sh --exec "ask ${question}?" --json`,
{ encoding: 'utf8' }
);
return JSON.parse(result);
}
const answer = query('Is Dog an Animal');
console.log(answer.result.truth); // TRUE_CERTAIN
| Aspect | Raw CLI | Chat Interface |
|---|---|---|
| Input | Structured Sys2DSL commands | Natural language |
| Determinism | 100% reproducible | LLM introduces variability |
| Dependencies | Node.js only | Node.js + LLM API |
| Batch mode | Full support | Interactive only |
| Best for | Testing, CI/CD, automation | Exploration, demos, learning |