lua: add package README with LuaRocks install instructions
Swadhin Biswas committed 7 months ago
f389247
1 parent 260775a
commit f389247
1 file changed
+64 -0
Showing 1 changed file+64-0
▼LUA/README.md
+64-0
| @@ -0,0 +1,64 @@ | ||
1 | +# contexa — Lua | |
2 | + | |
3 | +Git-inspired context management for LLM agents — **COMMIT**, **BRANCH**, **MERGE**, and **CONTEXT** operations over a persistent versioned memory workspace. | |
4 | + | |
5 | +Based on the paper *"Git Context Controller: Manage the Context of LLM-based Agents like Git"* ([arXiv:2508.00031](https://arxiv.org/abs/2508.00031)). | |
6 | + | |
7 | +## Install | |
8 | + | |
9 | +```bash | |
10 | +luarocks install contexa | |
11 | +``` | |
12 | + | |
13 | +## Quick Start | |
14 | + | |
15 | +```lua | |
16 | +local contexa = require("contexa") | |
17 | + | |
18 | +-- Create workspace | |
19 | +local ws = contexa.GCCWorkspace.new("/tmp/my-project") | |
20 | +ws:init("Build an AI agent") | |
21 | + | |
22 | +-- Log observations | |
23 | +ws:log_ota("User asked about weather", "Need to call API", "Called weather API") | |
24 | + | |
25 | +-- Commit milestone | |
26 | +ws:commit("Implemented weather lookup") | |
27 | + | |
28 | +-- Branch for exploration | |
29 | +ws:branch("alt-approach", "Try different API") | |
30 | +ws:log_ota("Testing new API", "Seems faster", "Switched to new API") | |
31 | +ws:commit("New API integration") | |
32 | + | |
33 | +-- Merge back | |
34 | +ws:merge("alt-approach", nil, "main") | |
35 | + | |
36 | +-- Retrieve context | |
37 | +local ctx = ws:context("main", 3) | |
38 | +print(contexa.context_summary(ctx)) | |
39 | +``` | |
40 | + | |
41 | +## API | |
42 | + | |
43 | +| Method | Description | | |
44 | +|--------|-------------| | |
45 | +| `GCCWorkspace.new(root)` | Create workspace handle | | |
46 | +| `ws:init(roadmap?)` | Initialize `.GCC/` directory | | |
47 | +| `ws:load()` | Attach to existing workspace | | |
48 | +| `ws:log_ota(obs, thought, action)` | Append OTA record | | |
49 | +| `ws:commit(contribution, prev?, roadmap?)` | Create milestone commit | | |
50 | +| `ws:branch(name, purpose)` | Create isolated branch | | |
51 | +| `ws:merge(branch, summary?, target?)` | Merge branch into target | | |
52 | +| `ws:context(branch?, k?)` | Retrieve hierarchical context | | |
53 | +| `ws:switch_branch(name)` | Switch active branch | | |
54 | +| `ws:list_branches()` | List all branches | | |
55 | +| `ws:current_branch()` | Get active branch name | | |
56 | + | |
57 | +## Requirements | |
58 | + | |
59 | +- Lua 5.1+ or LuaJIT | |
60 | +- LuaFileSystem (`lfs`) — optional but recommended for portable directory operations | |
61 | + | |
62 | +## License | |
63 | + | |
64 | +MIT | |
0 | 65 | |