Skip to content

feat(arigraph): 100%+ Python transcode — prompts, NARS, normalization, spatial#57

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/transcode-deepnsm-rust-oNa1Z
Mar 28, 2026
Merged

feat(arigraph): 100%+ Python transcode — prompts, NARS, normalization, spatial#57
AdaWorldAPI merged 1 commit into
mainfrom
claude/transcode-deepnsm-rust-oNa1Z

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Production prompts ported verbatim from Python AriGraph:

  • EXTRACTION_PROMPT: 590 words with examples and edge cases
  • REFINING_PROMPT: 400 words with 4 worked examples
  • SYSTEM_PLAN_AGENT, SYSTEM_ACTION_AGENT, EXPLORATION_CHECK_PROMPT
  • REFLEX_PROMPT for learning from mistakes

Triplet normalization (utils.py:163-172):

  • clear_triplet(): I→inventory, P→player, lowercase, strip punctuation
  • process_triplets(): digit strip, colon-delimited subject parsing
  • parse_triplets_removing(): [[old→new]] format from refinement output

Spatial graph (parent_graph.py:131-203):

  • compute_spatial_graph(): auto-extract edges from directional relations
  • find_path_directions(): BFS returning movement commands, not locations
  • find_direction()/find_opposite_direction(): cardinal direction mapping
  • is_spatial_connection(): north/south/east/west detection
  • find_unexplored_exits(): identify unvisited directions

Full update cycle (contriever_graph.py:26-84):

  • TripletGraph::update(): extract→exclude→refine→delete→spatial
  • exclude(): filter known triplets before sending to LLM
  • delete_with_location_protection(): won't soft-delete spatial triplets

NARS inference (from adaworldapi/ndarray hpc/nars.rs):

  • infer_deductions(): A→B, B→C ⟹ A→C with f=f1f2, c=f1f2c1c2
  • detect_contradictions(): same S+O, different relation, both confident
  • revise_with_evidence(): repeated observation increases confidence

Fix compilation: collect-before-mutate in compute_spatial_graph,
fix hex literal suffix in nsm_word.rs.

16 new tests for all ported functionality.

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7

…, spatial

Production prompts ported verbatim from Python AriGraph:
  - EXTRACTION_PROMPT: 590 words with examples and edge cases
  - REFINING_PROMPT: 400 words with 4 worked examples
  - SYSTEM_PLAN_AGENT, SYSTEM_ACTION_AGENT, EXPLORATION_CHECK_PROMPT
  - REFLEX_PROMPT for learning from mistakes

Triplet normalization (utils.py:163-172):
  - clear_triplet(): I→inventory, P→player, lowercase, strip punctuation
  - process_triplets(): digit strip, colon-delimited subject parsing
  - parse_triplets_removing(): [[old→new]] format from refinement output

Spatial graph (parent_graph.py:131-203):
  - compute_spatial_graph(): auto-extract edges from directional relations
  - find_path_directions(): BFS returning movement commands, not locations
  - find_direction()/find_opposite_direction(): cardinal direction mapping
  - is_spatial_connection(): north/south/east/west detection
  - find_unexplored_exits(): identify unvisited directions

Full update cycle (contriever_graph.py:26-84):
  - TripletGraph::update(): extract→exclude→refine→delete→spatial
  - exclude(): filter known triplets before sending to LLM
  - delete_with_location_protection(): won't soft-delete spatial triplets

NARS inference (from adaworldapi/ndarray hpc/nars.rs):
  - infer_deductions(): A→B, B→C ⟹ A→C with f=f1*f2, c=f1*f2*c1*c2
  - detect_contradictions(): same S+O, different relation, both confident
  - revise_with_evidence(): repeated observation increases confidence

Fix compilation: collect-before-mutate in compute_spatial_graph,
fix hex literal suffix in nsm_word.rs.

16 new tests for all ported functionality.

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants