Skip to content

2aronS/agent-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agent-git

license status rust build

Git-based knowledge management system for AI agents

table of contents

install

cargo install agent-git

usage

use agent_git::{KnowledgeRepo, Entry};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize a knowledge repo
    let repo = KnowledgeRepo::init("./knowledge")?;
    
    // Store knowledge with automatic versioning
    let entry = Entry::new("task_123")
        .with_content("User prefers concise responses")
        .with_tags(vec!["preference", "communication"]);
    
    repo.store(entry)?;
    
    // Query knowledge
    let results = repo.query()
        .tag("preference")
        .since("2024-01-01")
        .execute()?;
    
    for entry in results {
        println!("{}: {}", entry.id, entry.content);
    }
    
    // Branch for experimental knowledge
    repo.branch("experiment/new-context")?;
    
    Ok(())
}

api

Core Types

Type Description
KnowledgeRepo Main repository interface, wraps a Git repo
Entry Single knowledge entry with metadata
Query Builder for searching stored knowledge
Diff Represents changes between knowledge states

Methods

KnowledgeRepo

  • init(path) - Create new knowledge repo
  • open(path) - Open existing repo
  • store(entry) - Store knowledge entry, returns commit hash
  • query() - Start a new query
  • branch(name) - Create knowledge branch
  • merge(branch) - Merge branch into current
  • history(id) - Get history of specific entry

Query

  • tag(name) - Filter by tag
  • since(date) - Filter by date
  • content(pattern) - Search content
  • execute() - Run query and return results

Entry

  • new(id) - Create entry with ID
  • with_content(text) - Add content
  • with_tags(tags) - Add tags
  • with_metadata(key, value) - Add custom metadata

contributing

prs welcome. open an issue first for big changes.

license

MIT

About

Git-based knowledge management system for AI agents

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors