Skip to content

feat: Implement dynamic North Star and mission config#52

Open
gemini-25-pro-collab wants to merge 471 commits intokimeisele:mainfrom
gemini-25-pro-collab:feature/dynamic-north-star-mission-config
Open

feat: Implement dynamic North Star and mission config#52
gemini-25-pro-collab wants to merge 471 commits intokimeisele:mainfrom
gemini-25-pro-collab:feature/dynamic-north-star-mission-config

Conversation

@gemini-25-pro-collab
Copy link
Copy Markdown

This pull request implements dynamic North Star and mission configuration, as requested in issue #6. The hardcoded parameters have been moved from steward/services.py to a new campaigns/default.json configuration file. This allows for easier modification and management of campaign settings. Closes #6.

claude and others added 30 commits March 16, 2026 01:17
- ruff format: 16 files reformatted to pass `ruff format --check`
- bandit CI: remove invalid `--format github` flag + fallback hack
  Now uses `bandit -r steward/ -c pyproject.toml -q` directly
- All 3 CI gates pass locally: ruff check, ruff format, bandit

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
campaigns/default.json defined 4 success signals but nobody read them.
GENESIS passed ci_green=True (always) to Sankalpa. Steward generated
tasks on timers, not on actual need.

Now:
- campaign_signals.py evaluates all 4 signals against real system state:
  federation_healthy → SVC_REAPER alive/dead peer ratio
  immune_clean       → SenseCoordinator total_pain threshold
  ci_green           → GitSense CI workflow conclusion
  active_missions    → SVC_TASK_MANAGER pending count
- GENESIS feeds real ci_green to sankalpa.think() (was hardcoded True)
- Failing signals boost priority of relevant intents (+20 per signal)
  e.g. dead peers → federation_health/heal_repo get higher priority
- context_bridge surfaces campaign health in context.json for briefings
- 28 new tests covering all evaluators, priority boosting, caching

The chain: campaigns/default.json → evaluate() → CampaignHealth →
phase_genesis() → sankalpa.think(ci_green=real) + priority_boost()

0 new dependencies. 0 LLM tokens at runtime. ~150 LOC.

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
Sankalpa strategy `synthesize_briefing` fired intent_type="synthesize_briefing"
but TaskIntent had no corresponding enum member. phase_genesis() logged
"unknown intent_type" and dropped it every cycle — the briefing was never
autonomously refreshed.

- Add TaskIntent.SYNTHESIZE_BRIEFING to intents.py
- Add execute_synthesize_briefing() handler to IntentHandlers
- Handler is deterministic (0 LLM tokens): checks if context.json
  is newer than CLAUDE.md → returns problem → LLM uses synthesize_briefing tool
- Gracefully handles first boot (no context.json yet → nothing to do)

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
…json

NORTH_STAR_TEXT was hardcoded in services.py AND duplicated in
campaigns/default.json. The JSON was never read for this purpose.

Now services.py loads north_star from campaigns/default.json at import
time, with hardcoded fallback if the file is missing. This makes
campaigns/default.json the canonical config for both success signals
AND the North Star.

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
…ration

- Emit OP_PR_CREATED when fix pipeline creates autonomous PRs
- Emit OP_CI_STATUS when CI check detects status changes
- Export federation_health.json to data/federation/ (agent-city reads this)
- Update peer.json capabilities (proactive_pr, cross_repo_healing, authority_feed)

Closes the one-way federation gap: steward now broadcasts meaningful events
beyond heartbeats, enabling agent-city to surface them on Moltbook.

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
Generated by MokshaHealthReportHook — agent-city reads this file
for governance decisions via FederationRelay.read_federation_health().

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
- Derive dev conventions from pyproject.toml (ruff, pytest, bandit, python version)
- Load steward invariants from .steward/conventions.md (extensible, not hardcoded)
- Show service docstrings in architecture section (not just names)
- Include MURALI phase descriptions
- Remove noise (seed line) — keep actionable north star
- CRITICAL section only when something is actually wrong
- Fix duplicate headers (Status + Environment Perception)
- Extract helpers for testability (_collect_critical, _derive_conventions, etc.)

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
… explanation

conventions.md is now the agent's mental model — explains the cognitive
pipeline (Antahkarana: Manas→Buddhi→Chitta→Gandha), execution phases,
MURALI heartbeat cycle, key directories, system invariants, and dev workflow.

briefing.py includes it verbatim as orientation block, then appends
dynamic state (senses, health, issues, services with docstrings).

Previous approach was wrong: bullet-point rules from pyproject.toml
don't help an architect orient. The agent needs to understand HOW
the system thinks, WHERE things live, and WHAT it must never break.

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
…ns, auto-generated orientation

- Add steward/annotations.py: validated knowledge store with MahaCompression
  dedup, North Star alignment check, and Hebbian confidence tracking
- Add steward/tools/annotate.py: agent-facing tool for knowledge submission
  through the validation pipeline
- Rewrite steward/briefing.py: single write_claude_md() writer with rate
  limiting and hash dedup; auto-generate orientation from living code instead
  of static conventions.md; include validated annotations section; add
  AUTO-GENERATED header
- Fix moksha_bridge.py: remove direct CLAUDE.md write, use single writer
- Update synthesize_briefing.py: include validated annotations in LLM prompt
- Wire AnnotateTool into BuiltinToolProvider

Fixes the architectural conflict where MOKSHA hook (5s deterministic) and
Sankalpa mission (15m LLM) were competing writers for CLAUDE.md.

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
…ge, add temporal decay

- Restore conventions.md loading (irreplaceable knowledge: cognitive pipeline,
  philosophy, invariants) — was wrongly replaced with directory listing
- Remove _extract_invariants() and _detect_key_directories() — hardcoded prose
  in Python is worse than a visible file
- Remove redundant 5s rate limiter from write_claude_md() — the MOKSHA hook
  already handles rate limiting; write_claude_md() only does hash dedup now
- Add temporal decay to annotations: -0.02 weight/day, annotations that aren't
  reinforced naturally drop below threshold and stop appearing in CLAUDE.md

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
…tence

- Annotation weights stored in SynapseStore (same system as immune remedy
  confidence and tool success rates) instead of custom Hebbian logic
- Temporal decay via HebbianSynaptic.decay() in MOKSHA hook — regression
  toward 0.5, annotations that aren't reinforced naturally fade
- Pruning via HebbianSynaptic.trim() — weakest entries removed at capacity
- reinforce() uses SynapseStore.increment_weight/decrement_weight
- Annotation metadata (text, category, file_ref) stays in PersistentMemory;
  credibility lives in the synaptic substrate where it belongs
- Removed all custom decay logic — the substrate handles lifecycle

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
conventions.md: Complete agent mental model
- Identity section: architect role, 80/20 deterministic/LLM ratio
- Cognitive pipeline: full flow from Manas to Buddhi verdict
- Substrate primitives table: what to use, what NOT to rebuild
- Federation, safety gates, immune system — all in scannable format
- Invariants section: the things that must NEVER be violated

briefing.py: Restructured _format() for AI navigation
- New section order: Critical → Orientation → Status → Action → Knowledge
  → Environment → Toolbox → Architecture (highest priority first)
- New Status section: compact one-liner per subsystem (health, immune, fed)
- New Toolbox section: lists available tools with descriptions
- Architecture now grouped by function (Cognitive, Memory, Safety,
  Federation, Healing) instead of flat alphabetical list
- Federation peer table now includes capabilities column
- Removed duplicate health/immune info (was in both Environment and Status)

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
…efingStages

Replace the single _format() function in briefing.py with a composable
BriefingPipeline — same pattern as PhaseHookRegistry. Each CLAUDE.md section
is now a BriefingStage with priority ordering and should_run() gating.

12 stages registered by default (Identity, Critical, Orientation, Status,
Action, Knowledge, Environment, GapAwareness, FederationInsight, Toolbox,
Architecture, Sessions). Two new enrichment stages:
- GapAwarenessStage: detailed view of active capability gaps
- FederationInsightStage: research results from federation inbox

Cold-start aware — each stage gates on data availability, degrades gracefully
when ServiceRegistry is offline. All 18 existing tests pass unchanged.

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
Each BriefingStage now has a `compressible` property. Fixed stages
(Identity, Critical, Action) are never truncated. Variable stages
(Orientation, Environment, Architecture, Sessions, etc.) are truncated
in reverse priority order when the token budget is tight.

Budget modes act as a slider:
  BUDGET_COMPACT (800)   — identity + critical + partial orientation
  BUDGET_STANDARD (1500) — most sections included (default)
  BUDGET_FULL (3000)     — everything expanded
  BUDGET_UNLIMITED (0)   — no truncation

Metadata footer appended to every CLAUDE.md:
  <!-- briefing v2.0.0 | 1491 tokens | budget: standard (1500) | timestamp -->

This connects to the existing CBR DSP signal chain — the briefing output
token count is now a controllable output dimension alongside the per-call
CBR budget.

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
…ession

Each briefing stage now renders at variable detail (0.0-1.0) driven by
substrate signals — not dumb line-cutting. Like VR eye-tracking: the
system's "gaze" determines resolution per section.

Focus signals (all deterministic, zero LLM):
  - total_pain → urgency (high pain = full detail everywhere)
  - per-sense pain → boost corresponding stage (git pain = expand env)
  - context_pressure → proportional compression of all stages
  - active gaps → boost gap_awareness stage
  - health guna → base mood (tamas=urgent, sattva=compressed, rajas=balanced)

Stage rendering levels (example: ArchitectureStage):
  focus=1.0 → full grouped services + MURALI phases
  focus=0.5 → group counts + MURALI one-liner
  focus=0.1 → service count only

Token budget remains as a hard-ceiling safety net (CBR limiter),
but focus weights are the PRIMARY compression driver.

Metadata footer now includes focus driver:
  <!-- briefing v3.0.0 | 1389 tokens | budget: standard (1500) | focus: rajas | timestamp -->

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
…sion

The budget ceiling no longer cuts or drops stages. Instead, when output
exceeds budget, all stages are re-rendered with progressively lower focus
(0.8x per round, max 4 rounds). Every stage always appears — just at
lower resolution. Information is compressed, never lost.

Compact (800 tokens) now shows every section header + tables + key bullets.
Architecture shows group counts instead of full lists. Code blocks collapse.
But nothing is missing — it's all there, just denser.

Budget default raised to 2000 (research: 800-2000 sweet spot for AI agents,
Claude tolerates up to ~5500 before accuracy degradation).

Focus signal floors raised: orientation, architecture, environment never
drop below 0.7 — these are SIGNAL, not noise.

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
…guard seed display

OrientationStage at medium focus (0.3-0.7) was including ``` delimiters
without their content, creating ugly empty code blocks. Now properly
tracks code block state and skips both delimiters and content.

_get_seed_info() now only displays position when seed is present,
preventing orphaned "position 7" display without context.

https://claude.ai/code/session_01Keqm6RQCn9mEA9M3UCBYED
Agents are deterministic seeds. The AgentDeck provides:
- AgentCard: reusable agent profiles with capabilities, system prompts, tool filters
- Seed-based matching: compress(task) → seed → specialized agent profile
- Capability routing: SubAgentTool queries deck before spawning
- Hebbian learning: success/failure updates card weights
- Federation sharing: OP_SHARE_AGENT_CARD broadcasts proven cards to peers
- 5 starter cards: test_fixer, lint_fixer, code_reviewer, dependency_updater, explorer

Also adds:
- FEDERATION_GAP_SCAN intent: autonomous detection of federation architecture gaps
  (delivery reliability, agent card coverage, trust erosion, capability holes)
- MokshaAgentDeckHook: persists deck + broadcasts proven cards during MOKSHA phase
- Sankalpa mission: federation_gap_scan (every 20min, 3x/day)

29 new tests, all passing. 1799 existing tests unaffected.

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
Steward now reads agent-city's data/pokedex.json via GitHub API during
the GENESIS phase and imports active agents as AgentCards. Foreign cards
enter through ingest_shared_card() with 0.8x trust discount and must
prove themselves locally via Hebbian learning.

- New GenesisPokedexSyncHook (priority=25, 10-min rate limit)
- Zone/varna → capability mapping (governance, engineering, research, etc.)
- install_starter_cards() gains pokedex_seeded param to avoid duplicates
- Graceful degradation when agent-city is unavailable
- 19 new tests covering conversion, ingestion, filtering, resilience

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
… installed

AgentDeck is a closed system. Starter cards are Steward's core agent
profiles (like tools) — always present, never skipped. Federation
Pokedex sync is purely additive, never replacing.

Removes the pokedex_seeded parameter that would skip starter cards
when agent-city covered their capabilities (Wire-Fail-Abandon pattern).

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
- Add debug logging when seed computation fails (was silent except pass)
- Add logger.exception() on sub-agent crash (captures full traceback)
- Fix return type annotation on _resolve_card

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
- Moksha: log when federation unavailable for card broadcast
- Genesis: network fetch failures logged at WARNING (was DEBUG)
- Add tests for MokshaAgentDeckHook: persistence + no-federation path

https://claude.ai/code/session_01Rxe3yTrxafXJjv4sGqN3gs
steward-bot and others added 29 commits March 30, 2026 12:37
This commit refactors the hardcoded 'North Star' and mission parameters, moving them to a new  file. The  file has been updated to load these parameters from the new JSON file, making the system more configurable and dynamic.

This change addresses issue kimeisele#6.
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.

Campaigns system: dynamic North Star + mission config

3 participants