You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+29-35Lines changed: 29 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,47 +1,29 @@
1
-
# CLAUDE.md
1
+
# AGENTS.md
2
2
3
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3
+
Guidance for AI coding agents working **on** the automerge package. automerge provides R bindings to the Automerge Conflict-free Replicated Data Type (CRDT) library via its C FFI, enabling automatic merging of concurrent changes across distributed systems without conflicts. Zero R package dependencies (only base R).
4
4
5
-
## Project Overview
5
+
Claude Code users: add `.claude/CLAUDE.md` containing `@../AGENTS.md` to import this file (`.claude/` is gitignored).
6
6
7
-
This is an R package (`automerge`) that provides bindings to the Automerge Conflict-free Replicated Data Type (CRDT) library via its C FFI. The package enables automatic merging of concurrent changes across distributed systems without conflicts.
7
+
## Architecture
8
8
9
-
**Key Architecture:**
10
-
- R package with C bindings to Rust-based automerge-c library
9
+
- R package with C bindings to the Rust-based automerge-c library
-`objects.R`: Object operations (put, get, delete, insert) and type constructors
65
48
-`methods.R`: S3 methods for `am_doc`, `am_object`, and subtypes
@@ -71,6 +54,7 @@ The package uses a two-phase build approach:
71
54
All R functions are thin `.Call()` wrappers (e.g., `am_put <- function(doc, obj, key, value) invisible(.Call(C_am_put, doc, obj, key, value))`). All logic lives in C.
72
55
73
56
### C Layer (`src/`)
57
+
74
58
-`automerge.h`: Data structures, function declarations, CHECK_RESULT macro
75
59
-`document.c`: Document lifecycle operations
76
60
-`objects.c`: Map/list/text operations and R↔Automerge type conversion
@@ -81,6 +65,10 @@ All R functions are thin `.Call()` wrappers (e.g., `am_put <- function(doc, obj,
81
65
-`errors.c`: Error handling with file/line context
82
66
-`init.c`: R package registration (83 C functions)
83
67
68
+
## Formatter
69
+
70
+
Air, configured in `air.toml` (default settings).
71
+
84
72
## Code Style
85
73
86
74
- Comments should be sparse and address the "why", not the "what"
@@ -115,3 +103,9 @@ Text positions use Unicode code points, not bytes. The emoji "😀" counts as 1
115
103
-`CHECK_RESULT(result, expected_type)` macro validates AMresult* status and value type
116
104
- Automatically frees AMresult* on error before calling `Rf_error()` — caller must not use the result after CHECK_RESULT
117
105
- Includes file/line context for debugging (`__FILE__`, `__LINE__`)
106
+
107
+
## Packaging Notes
108
+
109
+
- roxygen2 with markdown; `NAMESPACE` is generated — never hand-edit.
110
+
- Version is `major.minor.patch.dev` (current dev tag `.9000`).
111
+
-`AGENTS.md`, `.claude/`, and `.posit/` are in `.Rbuildignore` and don't ship to CRAN.
0 commit comments