ge.memory¶
GitHub-backed durable memory for autonomous agent execution.
Three stores exposed as collections.abc facades. GitHub is the single
source of truth; a thin per-store local snapshot under .ge/cache/ is a
hydrate-only cache (disposable, never authoritative).
RoadmapStore—MutableMapping[task_id, TaskRecord]over a roadmap issue whose body holds a markdown task list between<!-- ge:roadmap:begin -->/<!-- ge:roadmap:end -->markers.DecisionLog— append-onlyIterable[Decision]backed by decision-tagged comments on an issue or PR.TriageBacklog—MutableMapping[issue_ref, TriageVerdict]spanning multiple repos. Backed by a tracking issue containing a fenced JSON block (<!-- ge:triage:begin -->/end). Cross-repo refs use"owner/repo#N".
The github_memory() factory bundles these into a mall.
Design notes¶
Writes go to GitHub first; the local cache is updated as a side-effect on successful round-trip. A failed write does not poison the cache.
check_requirementsverifiesghis installed, authenticated, and carries theprojectscope (needed if the user later switches the triage backend to a GitHub Project).
Functions
|
Bundle the three stores into a "mall" dict keyed by name. |
|
Verify external prerequisites for the memory layer. |
Classes
|
Roadmap task lifecycle state. |
|
A single roadmap task. |
|
Triage classification for an issue. |
|
A cross-repo triage backlog entry. |
|
A logged decision (rendered as a tagged comment on an issue/PR). |
|
A |
|
Append-only iterable of |
|
Cross-repo triage backlog. |
- class ge.memory.Decision(summary, rationale='', metadata=<factory>, created_at=None, url=None)[source]¶
Bases:
objectA logged decision (rendered as a tagged comment on an issue/PR).
- class ge.memory.DecisionLog(repo, target_number, *, cache_dir=None)[source]¶
Bases:
IterableAppend-only iterable of
Decisionrecords.Backed by issue/PR comments tagged with
<!-- ge:decision -->on a single target (issue or PR). Iteration fetches all comments from GitHub, filters by tag, and yields parsed decisions in chronological order.Significant choices and course-corrections should be appended here so they survive into future sessions. Micro-decisions belong in local scratch and should be summarised at handover.
- class ge.memory.RoadmapStore(repo, issue_number, *, cache_dir=None)[source]¶
Bases:
MutableMappingA
MutableMapping[task_id, TaskRecord]over a roadmap issue.Iteration yields task ids in roadmap order. Mutations rewrite the roadmap issue body in place; the local cache is updated on success.
Initialise via
github_memory()or directly with(repo, issue). The roadmap issue body should contain (or will be augmented with) a block:<!-- ge:roadmap:begin --> - [ ] Task one - [x] Task two <!-- ge:roadmap:end -->Tasks outside the block are ignored.
- append(title, *, state=TaskState.todo)[source]¶
Add a new task to the end of the roadmap.
- Return type:
- hydrate()[source]¶
Refresh the local cache from GitHub and return the current task list.
- Return type:
- class ge.memory.TaskRecord(id, title, state=TaskState.todo, metadata=<factory>)[source]¶
Bases:
objectA single roadmap task.
idis a stable slug derived from the title.metadataholds any extra agent-attached fields (e.g. links to PRs).
- class ge.memory.TriageBacklog(repo, tracking_issue, *, cache_dir=None)[source]¶
Bases:
MutableMappingCross-repo triage backlog.
Keys are issue refs of the form
"owner/repo#N"; values areTriageEntry. Iteration order is the agent-chosen resolution order (theorderfield).Backed by a tracking issue whose body holds a JSON block between
<!-- ge:triage:begin -->/end. This keeps the implementation free of GraphQL/Project dependencies while preserving full cross-repo semantics — fully-qualified refs do the heavy lifting.Switching to a GitHub Project backend later is a swap of this class’s I/O methods; the public interface stays the same.
- class ge.memory.TriageEntry(ref, verdict, order=0, rationale='', metadata=<factory>)[source]¶
Bases:
objectA cross-repo triage backlog entry.
- ge.memory.check_requirements(*, require_project_scope=False)[source]¶
Verify external prerequisites for the memory layer.
Returns a dict
{"ok": bool, "gh": ..., "auth": ..., "scopes": [...], "missing": [...]}. RaisesEnvironmentErrorwith actionable install instructions if a hard requirement is missing.Set
require_project_scope=Trueif you plan to swap the triage backend to a GitHub Project.- Return type:
- ge.memory.github_memory(repo, *, roadmap_issue=None, decisions_target=None, triage_issue=None, cache_dir=None)[source]¶
Bundle the three stores into a “mall” dict keyed by name.
Each store is only constructed if its target was provided.
roadmaprequiresroadmap_issue;decisionsrequiresdecisions_target(the issue or PR number where decisions are logged);triagerequirestriage_issue(the tracking issue holding the JSON block).>>> # mall = github_memory('owner/repo', roadmap_issue=1, decisions_target=1)