Metadata-Version: 2.4
Name: dimeai
Version: 0.1.0
Summary: DIMEFIL Analyst CLI - AI-powered geopolitical event analysis using temporal graph networks
Project-URL: Homepage, https://github.com/dimeai/dimeai
Project-URL: Documentation, https://github.com/dimeai/dimeai#readme
Project-URL: Repository, https://github.com/dimeai/dimeai
Project-URL: Issues, https://github.com/dimeai/dimeai/issues
Author-email: DimeAI Team <dimeai@example.com>
License: MIT
License-File: LICENSE
Keywords: cli,dimefil,entity-extraction,geopolitics,graph-neural-networks,nlp,security-analysis,temporal-graphs
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Requires-Dist: click>=8.1.0
Requires-Dist: ddgs>=6.0.0
Requires-Dist: gliner2>=0.1.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: networkx>=3.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0.0
Requires-Dist: scikit-learn>=1.3.0
Requires-Dist: sentence-transformers>=2.2.0
Requires-Dist: torch-geometric>=2.4.0
Requires-Dist: torch>=2.0.0
Provides-Extra: agent
Requires-Dist: boto3>=1.28.0; extra == 'agent'
Requires-Dist: strands-agents>=0.1.0; extra == 'agent'
Provides-Extra: all
Requires-Dist: black>=23.0.0; extra == 'all'
Requires-Dist: boto3>=1.28.0; extra == 'all'
Requires-Dist: hypothesis>=6.0.0; extra == 'all'
Requires-Dist: mypy>=1.0.0; extra == 'all'
Requires-Dist: pytest-cov>=4.0.0; extra == 'all'
Requires-Dist: pytest>=7.0.0; extra == 'all'
Requires-Dist: ruff>=0.1.0; extra == 'all'
Requires-Dist: strands-agents>=0.1.0; extra == 'all'
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: hypothesis>=6.0.0; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# DimeAI

DIMEFIL Analyst CLI - AI-powered geopolitical event analysis.

## Installation

```bash
cd dimeai
uv pip install -e .
```

## Quick Start

```bash
# Collect articles about a situation
dimeai collect "South China Sea tensions 2024" -n 20

# Extract entities and relationships
dimeai extract -i articles -o graph.json

# Train TGN model
dimeai train -g graph.json -o model.pt

# Analyze a situation
dimeai analyze "China coast guard incident" -m model.pt -g graph.json

# Interactive session
dimeai interactive -g graph.json

# Run benchmarks
dimeai benchmark -g graph.json
```

## Commands

| Command | Description |
|---------|-------------|
| `collect` | Collect articles via web scraping |
| `extract` | Extract entities with GLiNER 2 |
| `train` | Train TGN model |
| `analyze` | Analyze a situation |
| `simulate` | Interactive what-if simulation |
| `interactive` | REPL for graph exploration |
| `benchmark` | Compare TGN vs baselines |
| `features compute` | Compute semantic features |
| `features inspect` | Inspect node features |
| `config show` | Show configuration |
| `config set` | Set configuration value |
| `dossier list` | List investigation dossiers |
| `dossier create` | Create new dossier |
| `dossier show` | Show dossier details |
| `dossier open` | Interactive dossier session |
| `dossier collect` | Add articles to dossier |
| `dossier export` | Export dossier as graph |
| `dossier note` | Add analyst note |
| `dossier delete` | Delete dossier |

## Dossier System

Dossiers are persistent investigation sessions stored in SQLite (`~/.dimeai/dossiers.db`).

```bash
# Create a new dossier
dimeai dossier create "SCS Tensions 2024" -d "Investigating recent incidents"

# Collect articles (uses DuckDuckGo search)
dimeai dossier collect 1 "Philippines coast guard incident" -n 5

# Open interactive session
dimeai dossier open 1

# In session:
#   collect <query>  - Search and add articles
#   extract          - Extract entities from articles
#   articles         - List collected articles
#   entities         - List extracted entities
#   events           - List events
#   note <text>      - Add observation
#   hypothesis <text> - Add hypothesis
#   analyze          - Analyze patterns
#   export           - Export as graph JSON
#   quit             - Exit session

# Export dossier
dimeai dossier export 1 -o my_investigation.json
```

## DIMEFIL Framework

- **D**iplomatic - Protests, talks, negotiations
- **I**nformation - Propaganda, disinformation
- **M**ilitary - Exercises, deployments
- **E**conomic - Fishing, trade, sanctions
- **F**inancial - (not yet implemented)
- **I**ntelligence - (not yet implemented)
- **L**aw Enforcement - Coast guard, patrols

## Model Performance

| Model | Accuracy | Macro F1 | vs Random F1 |
|-------|----------|----------|--------------|
| Random | 16.0% | 14.1% | - |
| Majority | 20.1% | 5.6% | -8.5pp |
| **TGN** | **28.7%** | **20.9%** | **+6.9pp** |

TGN beats both baselines on Macro F1 (the right metric for imbalanced data).
Class-weighted loss helps the model learn rare classes (diplomatic, information).

## Limitations

1. **Low absolute accuracy** - 26.6% on 7-class problem
2. **Class imbalance** - legal (36%), law_enforcement (13%)
3. **Temporal patterns** - Response patterns show 79% law_enforcement → law_enforcement
4. **Graph heuristics** - Agent uses heuristics, not neural predictions

## Development

```bash
# Run tests
python -m pytest dimeai/tests/ -v

# Run property-based tests
python -m pytest dimeai/tests/test_properties.py -v
```
