Skill: frequensy23-coder/palantir-integration (version 1.0.1)

--- name: Maven-Tactical-Link version: 2.0.0 description: Advanced text-based integration suite for Palantir Maven Smart System (MSS). Manages targets, Kanban workflow, CDE risk assessment, SIGINT intelligence fusion, asset assignment, strike logistics, BDA reporting, and pattern-of-life analysis. author: "Tactical Dev Group" env_vars: - MSS_API_ENDPOINT - MSS_API_KEY tools: - name: initialize_config description: Saves the Palantir MSS API key and endpoint to the local .env file during initial setup. command: "python3 ./scripts/setup_env.py --key {{api_key}} --endpoint {{endpoint}}" parameters: [REDACTED_SECRET] endpoint: string - name: get_target_info description: Fetches detailed JSON data about a target (coordinates, classification, threat level, board status). command: "python3 ./scripts/get_target.py --id {{target_id}}" parameters: target_id: string - name: search_targets description: Searches for targets by type, status, grid square, or keyword. command: "python3 ./scripts/search_targets.py --query {{query}}" parameters: query: string - name: fetch_sigint_context description: Retrieves radio intercepts and SIGINT data within a radius of the target for a given time window. command: "python3 ./scripts/fetch_sigint.py --id {{target_id}} --radius_km {{radius_km}} --hours {{hours}}" parameters: target_id: string radius_km: string hours: string - name: check_cde_risks description: Calculates Collateral Damage Estimation for a target given a specific weapon type. command: "python3 ./scripts/check_cde.py --id {{target_id}} --weapon {{weapon_type}}" parameters: target_id: string weapon_type: string - name: list_available_assets description: Lists all available strike assets (drones, artillery, aircraft) with their current readiness, location, and munitions. command: "python3 ./scripts/list_assets.py --region {{region}}" parameters: region: string - name: assign_strike_asset description: Assigns a specific military asset to a target for a strike mission. command: "python3 ./scripts/assign_asset.py --id {{target_id}} --asset {{asset_id}}" parameters: target_id: string asset_id: string - name: update_kanban_status description: Moves a target card to the specified stage on the MSS Kanban board. command: "python3 ./scripts/update_status.py --id {{target_id}} --status {{status}}" parameters: target_id: string status: string - name: get_kanban_board description: Returns all targets currently on the Kanban board, grouped by column/stage. command: "python3 ./scripts/get_board.py --filter {{filter}}" parameters: filter: string - name: generate_bda_report description: Generates a Battle Damage Assessment report for a completed strike. command: "python3 ./scripts/generate_bda.py --id {{target_id}}" parameters: target_id: string - name: pattern_of_life description: Retrieves pattern-of-life analysis for a location or target over a specified number of days. command: "python3 ./scripts/pattern_of_life.py --id {{target_id}} --days {{days}}" parameters: target_id: string days: string - name: check_logistics description: Checks supply levels (fuel, munitions, spare parts) at a given base or FOB. command: "python3 ./scripts/check_logistics.py --base {{base_id}}" parameters: base_id: string - name: weather_report description: Fetches current and forecasted weather conditions for a target area (visibility, wind, cloud cover). command: "python3 ./scripts/weather_report.py --lat {{lat}} --lon {{lon}} --hours {{hours}}" parameters: lat: string lon: string hours: string - name: deconfliction_check description: Checks for friendly forces, no-fire zones, and restricted airspace near a target. command: "python3 ./scripts/deconfliction.py --id {{target_id}} --radius_km {{radius_km}}" parameters: target_id: string radius_km: string - name: timeline_events description: Returns a chronological timeline of all events (detections, status changes, strikes) for a target. command: "python3 ./scripts/timeline.py --id {{target_id}}" parameters: target_id: string --- ## Role & Objectives You are a text-based tactical operator interface for the Palantir Maven Smart System (MSS). Your job is to translate the operator's natural language commands into precise API calls via the provided tools, and return results as concise, actionable tactical reports. You do NOT have a graphical interface. All interaction happens through text in a chat/terminal window. ## Initialization Protocol On first interaction with any user: 1. Check if `MSS_API_KEY` is available in the environment. 2. If NOT available, ask the user: "MSS API key not found. Please provide your Palantir MSS API key and endpoint to initialize the connection." 3. Once the user provides the key, call `initialize_config` to save it to `.env`. 4. Confirm: "Configuration saved. System ready." ## Core Directives 1. **No Hallucinations:** Only report data returned by tools. Never invent target details, coordinates, statuses, or intelligence. 2. **Concise Format:** Responses must be brief, structured, and military-style. Use bullet points and headers. No emojis. No filler text. 3. **Safety Protocol (Critical):** Before executing ANY of the following actions, you MUST request explicit text confirmation from the operator: - Changing a target status to `approved` - Assigning a strike asset to a target - Any action that moves a target closer to engagement Format: "Confirm [action] for target [ID]: Y/N" 4. **Error Transparency:** If any script returns an error, output the raw error message. Do not mask or reinterpret API failures. 5. **Full Context Briefings:** When the operator asks for a "briefing" or "summary" on a target, call ALL relevant tools in sequence: `get_target_info`, `check_cde_risks`, `fetch_sigint_context`, `deconfliction_check`, and `weather_report`. Synthesize results into a single structured report. ## Standard Report Format When presenting target data, use this structure: ``` TARGET BRIEF: [ID] - Type: [classification] - Status: [current Kanban stage] - Grid: [coordinates] - Threat Level: [high/medium/low] RISK ASSESSMENT: - CDE Score: [value] - Civilian Proximity: [details] - No-Fire Zone Conflict: [yes/no] INTELLIGENCE: - SIGINT Summary: [key intercepts] - Pattern of Life: [activity summary] WEATHER: - Visibility: [value] - Wind: [speed/direction] - Cloud Cover: [percentage] AVAILABLE ASSETS: - [asset list with ETA and munitions] ``` ## Example Workflows ### Quick Target Check - **User:** "What's the status on target 405?" - **You:** Call `get_target_info`. Return brief status. ### Full Briefing - **User:** "Give me a full brief on target Alpha-10." - **You:** Call `get_target_info`, `check_cde_risks`, `fetch_sigint_context`, `deconfliction_check`, `weather_report`, and `pattern_of_life`. Combine into the standard report format above. ### Strike Authorization Flow - **User:** "Approve target 809 and assign Reaper-3." - **You:** First call `deconfliction_check` and `check_cde_risks`. Present results. Then ask: "Confirm approval and asset assignment for target 809 with Reaper-3: Y/N" - **User:** "Y" - **You:** Call `update_kanban_status` (status=approved), then `assign_strike_asset`. Report success. ### Board Overview - **User:** "Show me the board." - **You:** Call `get_kanban_board`. Present all targets grouped by stage. ### Post-Strike - **User:** "Generate BDA for target 612." - **You:** Call `generate_bda_report`. Present the formatted report. ### Logistics Check - **User:** "What's the ammo situation at FOB Alpha?" - **You:** Call `check_logistics`. Present supply levels.

path: requirements.txt
content: requests>=2.28.0
python-dotenv>=1.0.0


path: scripts/weather_report.py
content: import argparse
from mss_client import api_get


def weather_report(lat, lon, hours):
    data = api_get("/weather", params={"lat": lat, "lon": lon, "forecast_hours": hours})
    current = data["current"]

    print(f"WEATHER — {lat}, {lon}")
    print("=" * 40)

    print("\nCURRENT:")
    print(f"  Visibility: {current['visibility_km']} km")
    print(f"  Cloud Cover: {current['cloud_cover_percent']}%")
    print(f"  Ceiling: {current['ceiling_ft']} ft")
    print(f"  Wind: {current['wind_speed_kts']} kts from {current['wind_direction']}")
    print(f"  Temp: {current['temp_c']}C")
    print(f"  Precipitation: {current['precipitation']}")

    forecast = data.get("forecast", [])
    if forecast:
        print(f"\nFORECAST (next {hours}h):")
        for f in forecast:
            print(f"  {f['time']}: Vis {f['visibility_km']}km | Cloud {f['cloud_cover_percent']}% | Wind {f['wind_speed_kts']}kts | Precip: {f['precipitation']}")

    ops = data.get("operations_impact")
    if ops:
        print(f"\nOPS IMPACT:")
        print(f"  ISR viable: {ops['isr_viable']}")
        print(f"  Strike viable: {ops['strike_viable']}")
        print(f"  Notes: {ops['notes']}")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--lat", required=True)
    parser.add_argument("--lon", required=True)
    parser.add_argument("--hours", default="6")
    args = parser.parse_args()
    weather_report(args.lat, args.lon, args.hours)


path: scripts/list_assets.py
content: import argparse
from mss_client import api_get


def list_assets(region):
    data = api_get("/assets", params={"region": region, "status": "available"})
    assets = data.get("assets", [])

    if not assets:
        print(f"No available assets in region: {region}")
        return

    print(f"AVAILABLE ASSETS — Region {region.upper()} — Total: {len(assets)}\n")

    for a in assets:
        munitions = a.get("munitions", [])
        mun_str = ", ".join(f"{m['type']}x{m['count']}" for m in munitions)

        print(f"  [{a['id']}] {a['platform']} ({a['type']})")
        print(f"    Location: {a['location']} | Readiness: {a['readiness']}")
        print(f"    Fuel: {a['fuel_percent']}% | Avg ETA: {a['avg_eta_minutes']} min")
        print(f"    Munitions: {mun_str}\n")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--region", required=True)
    args = parser.parse_args()
    list_assets(args.region)


path: scripts/timeline.py
content: import argparse
from mss_client import api_get


def get_timeline(target_id):
    data = api_get(f"/targets/{target_id}/timeline")
    events = data.get("events", [])

    print(f"TIMELINE — Target {target_id} — {len(events)} events")
    print("=" * 40)

    for e in events:
        print(f"\n  [{e['timestamp']}] {e['type'].upper()}")
        print(f"    By: {e['actor']}")
        if e.get("detail"):
            print(f"    {e['detail']}")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--id", required=True)
    args = parser.parse_args()
    get_timeline(args.id)


path: scripts/setup_env.py
content: import argparse
import os


def save_env(api_key, endpoint):
    env_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), ".env")

    lines = []
    if os.path.exists(env_path):
        with open(env_path, "r") as f:
            for line in f:
                if not line.startswith("MSS_API_KEY=") and not line.startswith("MSS_API_ENDPOINT="):
                    lines.append(line)

    lines.append(f"MSS_API_KEY={api_key}\n")
    lines.append(f"MSS_API_ENDPOINT={endpoint}\n")

    with open(env_path, "w") as f:
        f.writelines(lines)

    print(f"Configuration saved. Endpoint: {endpoint}")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--key", required=True)
    parser.add_argument("--endpoint", default="https://mss.palantir.mil/api/v1")
    args = parser.parse_args()
    save_env(args.key, args.endpoint)


path: scripts/pattern_of_life.py
content: import argparse
from mss_client import api_get


def pattern_of_life(target_id, days):
    data = api_get("/intelligence/pol", params={"target_id": target_id, "days": days})

    print(f"PATTERN OF LIFE — Target {target_id} — Last {days} days")
    print("=" * 40)

    print(f"\nSUMMARY: {data['summary']}\n")

    activity = data.get("activity_windows", [])
    if activity:
        print("ACTIVITY WINDOWS:")
        for w in activity:
            print(f"  {w['time_range']}: {w['activity']} (observed {w['frequency']}x)")
        print()

    movements = data.get("movement_patterns", [])
    if movements:
        print("MOVEMENT PATTERNS:")
        for m in movements:
            print(f"  Route: {m['route']} | Freq: {m['frequency']}x | Last seen: {m['last_observed']}")
        print()

    associates = data.get("associated_entities", [])
    if associates:
        print("ASSOCIATED ENTITIES:")
        for a in associates:
            print(f"  [{a['id']}] {a['relation']}")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--id", required=True)
    parser.add_argument("--days", default="7")
    args = parser.parse_args()
    pattern_of_life(args.id, args.days)


path: scripts/check_cde.py
content: import argparse
from mss_client import api_get


def check_cde(target_id, weapon_type):
    data = api_get(f"/targets/{target_id}/cde", params={"weapon": weapon_type})

    print(f"CDE ASSESSMENT — Target {target_id} — Weapon: {weapon_type}\n")
    print(f"  CDE Score: {data['cde_score']}")
    print(f"  Risk Level: {data['risk_level']}")
    print(f"  Blast Radius: {data['blast_radius_m']}m")
    print(f"  Estimated Civilian Population: {data['estimated_civilian_population']}")
    print(f"  No-Fire Zone Conflict: {'YES' if data['no_fire_zone_conflict'] else 'No'}")

    structures = data.get("civilian_structures_in_radius", [])
    if structures:
        print(f"\n  Nearby Civilian Structures ({len(structures)}):")
        for s in structures:
            print(f"    - {s['name']} ({s['type']}) at {s['distance_m']}m")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--id", required=True)
    parser.add_argument("--weapon", default="hellfire")
    args = parser.parse_args()
    check_cde(args.id, args.weapon)


path: scripts/get_board.py
content: import argparse
from mss_client import api_get


def get_board(filter_str):
    params = {}
    if filter_str and filter_str.lower() != "all":
        params["filter"] = filter_str

    data = api_get("/board", params=params)
    columns = data.get("columns", {})

    if not columns:
        print("Board is empty.")
        return

    total = sum(len(targets) for targets in columns.values())
    print(f"KANBAN BOARD — {total} targets\n")

    for stage, targets in columns.items():
        print(f"=== {stage.upper()} ({len(targets)}) ===")
        for t in targets:
            print(f"  [{t['id']}] {t['type']} | Threat: {t['threat_level']} | Grid: {t['grid']} | Updated: {t['last_updated']}")
        print()


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--filter", default="all")
    args = parser.parse_args()
    get_board(args.filter)


path: scripts/get_target.py
content: import argparse
from mss_client import api_get, fmt_json


def fetch_target(target_id):
    data = api_get(f"/targets/{target_id}")
    print(fmt_json(data))


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--id", required=True)
    args = parser.parse_args()
    fetch_target(args.id)


path: scripts/generate_bda.py
content: import argparse
from mss_client import api_get


def generate_bda(target_id):
    data = api_get(f"/targets/{target_id}/bda")

    strike = data["strike_details"]
    damage = data["damage_assessment"]
    collateral = data["collateral_assessment"]
    restrike = data["restrike_recommendation"]

    print(f"BATTLE DAMAGE ASSESSMENT — Target {target_id}")
    print("=" * 40)

    print("\nSTRIKE DETAILS:")
    print(f"  Timestamp: {strike['timestamp']}")
    print(f"  Weapon: {strike['weapon']}")
    print(f"  Asset: {strike['asset_id']}")
    print(f"  Impact Coordinates: {strike['impact_coords']}")

    print("\nDAMAGE ASSESSMENT:")
    print(f"  Classification: {damage['classification']}")
    print(f"  Destruction: {damage['destruction_percent']}%")
    print(f"  Functional Kill: {damage['functional_kill']}")
    print(f"  Secondary Explosions: {damage['secondary_explosions']}")
    print(f"  Fires: {damage['fires_observed']}")

    print("\nCOLLATERAL ASSESSMENT:")
    print(f"  Civilian Damage: {collateral['civilian_damage']}")
    print(f"  Infrastructure Impact: {collateral['infrastructure_impact']}")

    print("\nRECOMMENDATION:")
    print(f"  Restrike Needed: {restrike['needed']}")
    print(f"  Reason: {restrike['reason']}")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--id", required=True)
    args = parser.parse_args()
    generate_bda(args.id)


path: scripts/update_status.py
content: import argparse
from mss_client import api_patch


VALID_STATUSES = ["detected", "review", "approved", "engaged", "completed", "rejected"]


def update_status(target_id, new_status):
    status_lower = new_status.lower()
    if status_lower not in VALID_STATUSES:
        print(f"ERROR: Invalid status '{new_status}'. Valid: {', '.join(VALID_STATUSES)}")
        return

    data = api_patch(f"/targets/{target_id}/status", payload={"status": status_lower})
    print(f"Target {target_id}: {data['previous_status']} -> {status_lower}")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--id", required=True)
    parser.add_argument("--status", required=True)
    args = parser.parse_args()
    update_status(args.id, args.status)


path: scripts/search_targets.py
content: import argparse
from mss_client import api_get


def search(query):
    data = api_get("/targets/search", params={"q": query})
    results = data.get("results", [])

    if not results:
        print(f"No targets found matching: {query}")
        return

    print(f"Found {len(results)} target(s):\n")
    for t in results:
        print(f"  [{t['id']}] Type: {t['type']} | Status: {t['status']} | Grid: {t['grid']} | Threat: {t['threat_level']}")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--query", required=True)
    args = parser.parse_args()
    search(args.query)


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)