a digital entity named phi that roams bsky phi.zzstoatzz.io
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

consume compacted relationship summaries from turbopuffer

adds get_relationship_summary() to NamespaceMemory — queries kind=summary
rows by attribute rank (no dummy vector). injected into build_user_context
between core identity and known facts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

zzstoatzz 08b6f326 235d884b

+23
+23
src/bot/memory/namespace_memory.py
··· 259 259 except Exception as e: 260 260 logger.warning(f"observation extraction failed for @{handle}: {e}") 261 261 262 + async def get_relationship_summary(self, handle: str) -> str | None: 263 + """Get the compacted relationship summary for a user, if one exists.""" 264 + user_ns = self.get_user_namespace(handle) 265 + try: 266 + response = user_ns.query( 267 + rank_by=("created_at", "desc"), 268 + top_k=1, 269 + filters={"kind": ["Eq", "summary"]}, 270 + include_attributes=["content"], 271 + ) 272 + if response.rows: 273 + return response.rows[0].content 274 + except Exception as e: 275 + if "not found" not in str(e).lower(): 276 + logger.warning(f"failed to fetch relationship summary for @{handle}: {e}") 277 + return None 278 + 262 279 async def _get_observations(self, handle: str, top_k: int = 20) -> list[str]: 263 280 """Get existing observation content strings for a user.""" 264 281 user_ns = self.get_user_namespace(handle) ··· 289 306 for mem in sorted(core_memories, key=lambda x: x.get("importance", 0), reverse=True): 290 307 label = mem.get("label", "unknown") 291 308 parts.append(f"[{label}] {mem['content']}") 309 + 310 + # relationship summary (synthesized by compact flow) 311 + summary = await self.get_relationship_summary(handle) 312 + if summary: 313 + parts.append(f"\n[RELATIONSHIP SUMMARY FOR @{handle}]") 314 + parts.append(summary) 292 315 293 316 user_ns = self.get_user_namespace(handle) 294 317 try: