# Sesi Programming Language Roadmap

## Version 1.0 - Foundation (Complete)

**Status**: Complete V1.0 implementation  
**Ready for**: Exploration, learning, building prototypes  
**Not ready for**: Production systems (until v2.0 with error handling)  
**Next milestone**: V1.1

### Core Language Features ✅

- [x] Variables and bindings (let) (const is deprecated)
- [x] Functions with parameters and types
- [x] Control flow (if/else, while, for, try/catch)
- [x] Operators (arithmetic, logical, comparison)
- [x] Arrays and objects
- [x] Type system with inference
- [x] Comments (// and /\* \*/)
- [x] String concatenation
- [x] Error handling (try/catch blocks)

### Integrated Reasoning Features ✅

- [x] Prompt blocks
- [x] Reasoning model calls (model())
- [x] Structured output (structured_output())
- [x] Tool calling (tool_call())
- [x] Stateful context management (memory)

### Built-in Functions ✅

- [x] show (renamed from now deprecated `print` in v1.8.5), type, str, num, bool
- [x] len, push, pop, join, split
- [x] range, keys, values
- [x] read_file, write_file
- [x] spawn, exec (Concurrency & Systems)
- [x] time, random (Utilities)
- [x] Array and object operations

### Tooling ✅

- [x] Lexer and parser
- [x] Tree-walking interpreter (retained as fallback execution path)
- [x] CLI executable (sesi)
- [x] Examples (22 programs)
- [x] Documentation

### Limitations

- Interpreter is Single-threaded (use `spawn()` for concurrency)
- No async/await
- Blocking Reasoning calls
- Limited error messages
- No pattern matching
- No generics or custom types

---

## Version 1.5 - Improvements (Complete)

**Status**: Complete V1.5 implementation  
**Ready for**: File manipulation and process orchestration  
**Not ready for**: Massive-scale production (until v2.0 bytecode)  
**Next milestone**: V2.0

### Improvements & Features ✅

- [x] Systems Builtins: `spawn`, `exec`, `time`, `random`
- [x] Concurrency: Async polling via file locks for completion and MAX_TOKENS
- [x] Image Generation primitive (`image`) and Config blocks (`ratio`, `size`)
- [x] File Management Builtins: `list_dir`, `write_image`
- [x] Documentation improvements (Extensive Markdown guides)
- [x] Bug fixes (tool_call argument passing resolved)
- [x] Simple error recovery (Parser synchronization)
- [x] Implicit statement termination for blocks ending in `}`
- [x] Temporal Context Injection for reasoning calls
- [x] Concurrency capabilities (File-based lock pattern)
- [x] API reference (`BUILTINS.md`)
- [x] Tutorial: Getting started (`QUICKSTART.md`)
- [x] Cookbook: Common patterns (`WRITING_SCRIPTS.md`)

### Deferred to V2.0 ⏳

- [x] Better error messages with line numbers and stack traces
- [x] REPL (Read-Eval-Print Loop)
- [x] String escape sequences & Multiline strings
- [x] Comments preservation (for docs)
- [x] Type hints in function signatures
- [x] Performance optimizations
- [x] Tutorial: Writing scripts

---

## Version 2.0 - Advanced Concurrency & Logic (In Progress)

**Focus**: Advanced reasoning features and native concurrency

### Async/Await Support

- [x] async/await syntax (language level)
- [x] Parallel reasoning calls (native)
- [x] Promise-like operations
- [x] Concurrent execution (Multi-process via `spawn`)

### Advanced Features

- [x] Streaming responses
- [x] Extended thinking
- [x] Multi-step workflows
- [x] Tool composition and piping
- [x] Custom tool definitions
- [x] Function calling with automatic orchestration
- [x] Web search grounding

### Memory System

- [ ] Long-term memory with embeddings
- [x] Memory search by similarity
- [x] Context window management
- [x] Automatic summarization
- [x] Persistent storage (file-based)

### Error Handling

- [x] finally blocks (try/catch completed in V1)
- [x] Custom error types
- [x] Error recovery strategies
- [x] Retry logic with exponential backoff
- [x] Timeout handling (`timeout(...)` helper and CLI `--timeout`)

### Performance

- [x] Bytecode compilation (VM + compiler foundation: expressions, loops, functions, closures, try/catch, imports)
- [x] Logic caching
- [x] Token counting and cost estimation (`count_tokens`, explicit `estimate_tokens`, `estimate_cost`, and provider-backed `model_usage`)
- [x] Lazy evaluation (`lazy(...)` / `force(...)` memoized delayed computations)

### New Built-ins

- [x] String functions (to_upper, to_lower, trim, slice, swap)
- [x] Array functions (map, filter, reduce, find, etc.)
- [x] Math functions (sqrt, sin, cos, floor, ceil, etc.)
- [x] Date/time functions
- [x] JSON parsing and serialization
- [x] HTTP client (get, post)

### Module System

- [x] import/export statements
- [x] Standard library modules (std/math, std/time, etc.)
- [x] Third-party package management
- [x] Lib support

### Tooling

- [x] Debugger with breakpoints
- [x] Profiler for performance analysis (`profile(...)`, manual sections, and CLI `--profile`)
- [x] AST visualization
- [x] Token stream visualization
- [x] Type checking tool
- [x] Linter and formatter (Native, no external dependencies)

### Examples

- [x] Web scraper with reasoning analysis
- [x] Command line utility expansion
- [x] Chatbot with memory
- [x] Data pipeline with reasoning
- [x] API server (with async)

---

## Version 3.0 - Robust Logic Frameworks (2027)

**Focus**: Complete language tooling

### Technical Frameworks

- [ ] Advanced scripting definition models
- [ ] Logic composition and chaining
- [ ] Extended process collaboration
- [ ] Communication protocols
- [ ] Persistence layer

### Knowledge Base

- [ ] Vector database integration
- [ ] Semantic search
- [ ] Knowledge graph support
- [ ] RAG (Retrieval-Augmented Generation)
- [ ] Document indexing

### Advanced Patterns

- [ ] Sub-process execution workflows
- [ ] Modular scripting decomposition
- [ ] Retry safety check loops
- [ ] Deep AST reflection
- [ ] Human-in-the-loop prompts

### Ecosystem

- [x] Package registry
- [ ] Community extensions
- [ ] Plugin system
- [x] API server template
- [ ] Dashboard/UI toolkit

### Examples

- [ ] Automated code formatting process
- [ ] Document processor (PDF, DOCX)
- [ ] Code generation and testing
- [ ] Data analysis pipeline
- [ ] Multi-process reasoning debate

---

## Version 4.0+ - Vision (2027+)

**Focus**: Maturity, optimization, and specialization

### Potential Features

- [ ] Compilation to JavaScript/WASM
- [ ] JIT compilation for hot paths
- [ ] Distributed execution
- [ ] Cross-model orchestration (Gemini, Claude, etc.)
- [ ] Vision model integration
- [ ] Audio processing
- [ ] Real-time streaming
- [ ] Genetic programming / AutoML
- [ ] Formal verification
- [ ] Type refinement system

### New Language Constructs

- [ ] Pattern matching
- [ ] Generics and templates
- [ ] Traits/interfaces
- [ ] Macros
- [ ] DSL support
- [ ] Concurrent primitives (channels, mutexes)

### Performance

- [ ] LLVM backend option
- [ ] WebAssembly compilation
- [ ] GPU acceleration
- [ ] Distributed computing

---

## Feature Priority Matrix

| Feature         | Priority  | V1  | V2  | V3  | V4+ |
| --------------- | --------- | --- | --- | --- | --- |
| Basic syntax    | 🔴 High   | ✅  |     |     |     |
| Functions       | 🔴 High   | ✅  |     |     |     |
| Reasoning calls | 🔴 High   | ✅  |     |     |     |
| Error handling  | 🔴 High   | ✅  |     |     |     |
| Async/await     | 🔴 High   |     | ✅  |     |     |
| Streaming       | 🟡 Medium |     | ✅  |     |     |
| Process Logic   | 🟡 Medium |     |     | ⏳  |     |
| Knowledge base  | 🟡 Medium |     |     | ⏳  |     |
| Module system   | 🟡 Medium |     | ⏳  |     |     |
| Debugger        | 🟢 Low    |     | ⏳  |     |     |
| Compilation     | 🟢 Low    |     |     |     | ⏳  |
| GPU support     | 🟢 Low    |     |     |     | ⏳  |

---

## Release Timeline

```
2026 Q2
└─ v5 - Polish & stabilize

2026 Q3-Q4
└─ v2.0 - Async & advanced APIs

2027 Q1-Q2
└─ v3.0 - Language Ecosystem

2027 Q3+
└─ v4.0+ - Mature compilation
```

---

## Community & Contribution

### Planned Community Activities

- [x] Public GitHub repository
- [ ] Discord/Slack community
- [ ] Monthly community calls
- [ ] RFCs (Request for Comments) for major features
- [x] Contribution guidelines
- [ ] Code of conduct

### How to Help (When Open Source)

- Test programs and report bugs
- Contribute documentation
- Submit examples
- Propose language features
- Implement built-in functions
- Build tools and extensions

---

## Backwards Compatibility

### Stability Guarantee

- **v1.x → v1.y**: Full backwards compatibility
- **v1.x → v2.0**: Mostly compatible, deprecation warnings for breaking changes
- **v2.x → v3.0**: New features, old syntax still works

### Deprecation Policy

1. Announce deprecation (1 version ahead)
2. Show warnings in compiler
3. Provide migration guide
4. Remove in next major version

---

## Open Questions & Design Discussions

### For the Community

1. Should we support object-oriented programming (classes, inheritance)?
2. Should we add pattern matching or keep it simple?
3. Should memory be file-based by default or in-memory?
4. How should we handle multi-model orchestration?
5. Should processes be stateful or functional?

### Technical Decisions

- Type system: Gradual or strict?
- Concurrency: Async/await or coroutines?
- Module system: Centralized registry or decentralized?
- Error handling: Exceptions or Result types?

---

## Performance Goals

| Metric                 | V1         | V2     | V3     |
| ---------------------- | ---------- | ------ | ------ |
| Startup time           | <100ms     | <100ms | <50ms  |
| Simple expression eval | <1µs       | <100ns | <10ns  |
| Function call overhead | <10µs      | <1µs   | <100ns |
| Reasoning latency      | 2-5s (API) | 2-5s   | 2-5s   |
| Memory usage           | <50MB      | <50MB  | <100MB |

---

## Inspiration & References

### Language Design

- **Python**: Simplicity, readability
- **Lua**: Lightweight, embeddable
- **JavaScript**: Functions as first-class values
- **Go**: Clear error handling
- **Rust**: Type safety, memory safety

### Code Control

- **CLI utilities**: Direct data piping
- **Shell scripting**: Execution transparency
- **Modern SDKs**: Model abstraction

### Community

- **Rust community**: Welcoming, inclusive
- **Python community**: Documentation focus
- **Go community**: Simplicity first

---

## Conclusion

Sesi is designed to evolve with reasoning needs. The roadmap balances:

- **Simplicity** (v1: core features only)
- **Power** (v2: advanced reasoning and extended functionality)
- **Maturity** (v3: comprehensive libraries and frameworks)
- **Scale** (v4+: production readiness and compilation)

The journey from v1 (interpreter) to v4+ (distributed compiler) maintains backward compatibility while adding power where needed.

**Current focus**: Ship v2.0 with native async/await and advanced reasoning patterns.

---

## See Also

- [Quick Start Guide](../QUICKSTART.md)
- [Language Specification](SPECIFICATION.md)
- [Runtime Architecture](ARCHITECTURE.md)
- [Built-in Functions Reference](BUILTINS.md)
- [Command Line Interface (CLI) Reference](CLI.md)
- [Tutorial: Writing Scripts](WRITING_SCRIPTS.md)
- [Image Generation & Input](IMAGE_GENERATION.md)
- [Compare to other languages](COMPARISON.md)
- [Reasoning & Simple Logic](REASONING.md)
- [Examples](../examples)
