
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
anchor-tagwalker
Advanced tools
Graph-based associative search with 70/30 budget split (STAR algorithm)
Graph-based associative search implementing the STAR algorithm with 70/30 budget split
use anchor_tagwalker::{TagWalker, TagWalkerConfig};
// Create walker
let mut walker = TagWalker::new();
// Add atoms with tags
walker.add_atom(1, "Rust programming", vec!["#rust".to_string(), "#programming".to_string()]);
walker.add_atom(2, "Python scripting", vec!["#python".to_string(), "#scripting".to_string()]);
walker.add_atom(3, "Rust performance", vec!["#rust".to_string(), "#performance".to_string()]);
// Configure search
let config = TagWalkerConfig::default();
// Search
let results = walker.search("#rust", &config);
for result in results {
println!("Atom {}: relevance {:.3} ({:?})",
result.atom_id, result.relevance, result.result_type);
}
gravity = (shared_tags) × e^(-λ×Δt) × (1 - hamming_distance/64) × damping
│ │ │ │
│ │ │ └─ Multi-hop damping (0.85)
│ │ └─ SimHash similarity (0.0-1.0)
│ └─ Temporal decay (λ=0.00001)
└─ Tag association count
use anchor_tagwalker::TagWalkerConfig;
// Default config (70/30 split, λ=0.00001, damping=0.85)
let config = TagWalkerConfig::default();
// Quick search (fewer results, single hop)
let config = TagWalkerConfig::quick();
// Deep exploration (more results, 3 hops)
let config = TagWalkerConfig::deep();
// Custom config
let config = TagWalkerConfig::new()
.with_planet_budget(0.8)
.with_moon_budget(0.2)
.with_max_results(100)
.with_max_hops(2)
.with_damping(0.9);
pub struct TagWalker {
// Bipartite graph: atoms ↔ tags
}
impl TagWalker {
pub fn new() -> Self;
pub fn add_atom(&mut self, id: u64, content: &str, tags: Vec<String>);
pub fn search(&self, query: &str, config: &TagWalkerConfig) -> Vec<SearchResult>;
pub fn search_with_budget(&self, query: &str, config: &TagWalkerConfig, total_tokens: usize) -> ContextPackage;
}
pub struct SearchResult {
pub atom_id: u64, // Atom ID
pub relevance: f32, // Gravity score
pub matched_tags: Vec<String>, // Tags that matched
pub result_type: ResultType, // Planet or Moon
pub path: Vec<String>, // Path from query (for moons)
}
pub enum ResultType {
Planet, // Direct FTS match
Moon, // Graph-discovered
}
use anchor_tagwalker::{TagWalker, TagWalkerConfig, BudgetAllocator};
let mut walker = TagWalker::new();
// ... add atoms ...
let config = TagWalkerConfig::default();
let package = walker.search_with_budget("#rust", &config, 8192);
println!("Planets: {}", package.planets.len());
println!("Moons: {}", package.moons.len());
println!("Budget used: {} / {}", package.tokens_used, package.budget_limit);
println!("Utilization: {:.1}%", package.utilization() * 100.0);
use anchor_tagwalker::TagWalker;
use std::collections::HashMap;
let mut walker = TagWalker::new();
// Load synonym ring
let mut ring = HashMap::new();
ring.insert("#rust".to_string(), vec![
"#programming".to_string(),
"#systems".to_string(),
"#performance".to_string(),
]);
walker.set_synonym_ring(ring);
// Search for "#rust" will also match "#programming", etc.
let results = walker.search("#rust", &TagWalkerConfig::default());
[dependencies]
anchor-tagwalker = "0.1.0"
Or:
cargo add anchor-tagwalker
use anchor_tagwalker::{TagWalker, TagWalkerConfig};
fn build_knowledge_index() -> TagWalker {
let mut walker = TagWalker::new();
// Add your knowledge atoms
walker.add_atom(1, "Rust ownership system", vec!["#rust", "#memory"]);
walker.add_atom(2, "Python decorators", vec!["#python", "#metaprogramming"]);
walker.add_atom(3, "Rust borrowing", vec!["#rust", "#references"]);
walker
}
fn search_knowledge(walker: &TagWalker, query: &str) {
let config = TagWalkerConfig::quick();
let results = walker.search(query, &config);
println!("Search results for '{}':", query);
for result in results {
let kind = match result.result_type {
anchor_tagwalker::ResultType::Planet => "🪐",
anchor_tagwalker::ResultType::Moon => "🌙",
};
println!(" {} Atom {}: {:.3}", kind, result.atom_id, result.relevance);
}
}
use anchor_tagwalker::{TagWalker, TagWalkerConfig};
let mut walker = TagWalker::new();
// Create interconnected graph
walker.add_atom(1, "Rust", vec!["#rust", "#lang"]);
walker.add_atom(2, "Programming", vec!["#lang", "#coding"]);
walker.add_atom(3, "Software", vec!["#coding", "#engineering"]);
walker.add_atom(4, "Engineering", vec!["#engineering", "#math"]);
// Deep search (3 hops)
let config = TagWalkerConfig::deep();
let results = walker.search("#rust", &config);
// Will discover atoms beyond direct connections
use anchor_tagwalker::{TagWalker, TagWalkerConfig};
let walker = TagWalker::new();
let config = TagWalkerConfig::default();
// Allocate 4096 tokens for context
let package = walker.search_with_budget("#query", &config, 4096);
// Access results
for planet in &package.planets {
println!("Planet: {:.3}", planet.relevance);
}
for moon in &package.moons {
println!("Moon: {:.3}", moon.relevance);
}
// Check budget
println!("Used {} / {} tokens", package.tokens_used, package.budget_limit);
Query
│
▼
┌─────────────────┐
│ Expand Query │ Synonym ring expansion
└────────┬────────┘
│
▼
┌─────────────────┐
│ Find Planets │ Direct FTS matches (70% budget)
└────────┬────────┘
│
▼
┌─────────────────┐
│ Find Moons │ Graph walk via shared tags
│ (Gravity Score) │ gravity = tags × decay × sim × damping
└────────┬────────┘
│
▼
┌─────────────────┐
│ Radial Inflation│ Multi-hop walking (if configured)
└────────┬────────┘
│
▼
┌─────────────────┐
│ Budget Allocate │ Respect 70/30 split
└────────┬────────┘
│
▼
Search Results
cargo test --all-features
cargo bench
Sample output:
search_100_atoms time: [50.0 µs 52.0 µs 54.0 µs]
search_with_synonyms time: [60.0 µs 62.0 µs 64.0 µs]
radial_inflation time: [150.0 µs 155.0 µs 160.0 µs]
add_atom time: [2.0 µs 2.1 µs 2.2 µs]
| Metric | Target |
|---|---|
| Search p95 (100 atoms) | ≤200ms |
| Gravity calculation | ≤1µs per atom |
| Radial inflation (3 hops) | ≤500ms |
| Memory usage | <10MB for 10k atoms |
AGPL-3.0 - See LICENSE for details.
anchor-fingerprint: SimHash for similarity scoringanchor-keyextract: Synonym ring supportrand: Random sampling for serendipityserde: SerializationFAQs
Graph-based associative search with 70/30 budget split (STAR algorithm)
We found that anchor-tagwalker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.