Skip to content

Instantly share code, notes, and snippets.

View yaravind's full-sized avatar
💭
Constraints Liberate. Liberties Constrain.

Aravind Yarram yaravind

💭
Constraints Liberate. Liberties Constrain.
View GitHub Profile
@yaravind
yaravind / README.md
Created May 14, 2026 22:52 — forked from patleeman/README.md
How OpenAI Codex implements the /goal slash command -- persisted long-running task objectives

Codex /goal Implementation

How OpenAI's Codex CLI implements the /goal slash command for persisted long-running task objectives.

The /goal command sets a persisted objective for a long-running task. It's a five-layer system: a SQLite table stores one goal per thread with status (active/paused/budget_limited/complete), optional token budget, and running usage counters. The app-server exposes thread/goal/set/get/clear JSON-RPC methods. The model sees three tools — create_goal, update_goal(complete), and get_goal — but can't pause/resume; those are system-controlled. A runtime event bus hooks into turn lifecycle to track token + wall-clock deltas for accounting, auto-pauses on interrupt, auto-reactivates paused goals on thread resume, and injects budget-limit steering into the model's response stream. The TUI handles the /goal slash command and displays goal state in the status bar.

Author: etraut-openai | 5 PRs, ~15K additions, landed in ~10 days (Apr 16–25, 2026)


@yaravind
yaravind / prompt-show-instructions-used.prompt.md
Created February 14, 2026 17:59
prompt-show-instructions-used.prompt.md
name show-instructions-used
description Require every Copilot Chat response to include an `Instructions used` footer listing any custom instructions used ".github/copilot-instructions.md" plus any matching path-scoped ".github/instructions/*.instructions.md" files or "(no scoped instructions)".
agent ask

Context

We have a repo with:

@yaravind
yaravind / KMeansSparkMLToMLLib.scala
Last active July 3, 2020 23:16
SparkML to MLLib conversion to run BisectingKMeans clustering
import org.apache.spark.mllib.clustering.BisectingKMeans
import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.mllib.linalg.Vector
//std_features col is of type vector
scaledFeatures.select($"std_features").printSchema()
val tempFeatureRdd = scaledFeatures.select($"std_features").rdd
import scala.reflect.runtime.universe._
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
from pyspark.sql import Row
from pyspark.sql.types import IntegerType
# Create the Spark session
spark = SparkSession.builder \
.master("local") \
.config("spark.sql.autoBroadcastJoinThreshold", -1) \
.config("spark.executor.memory", "500mb") \
import org.apache.spark.ml.Pipeline
import org.apache.spark.ml.PipelineStage
import org.apache.spark.ml.Transformer
import org.apache.spark.ml.classification.LogisticRegression
import org.apache.spark.ml.feature.LabeledPoint
import org.apache.spark.ml.linalg.DenseVector
import org.apache.spark.ml.linalg.Vectors
import org.apache.spark.ml.param.ParamMap
import org.apache.spark.sql.Dataset
import org.apache.spark.sql.Row
@yaravind
yaravind / WikiPageClustering.java
Created April 28, 2020 18:04 — forked from Jeffwan/WikiPageClustering.java
Machine Learning Pipleline
package com.diorsding.spark.ml;
import java.util.Arrays;
import java.util.List;
import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;
import org.apache.spark.ml.Pipeline;
import org.apache.spark.ml.PipelineModel;
import org.apache.spark.ml.PipelineStage;
import java.util.Arrays;
import java.util.List;
import org.apache.hadoop.yarn.webapp.hamlet.HamletSpec.P;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.MapFunction;
import org.apache.spark.ml.Pipeline;
import org.apache.spark.ml.PipelineModel;
import org.apache.spark.ml.PipelineStage;
@yaravind
yaravind / DataFrameWithFileName.scala
Created April 15, 2020 03:22 — forked from satendrakumar/DataFrameWithFileName.scala
Add file name as Spark DataFrame column
import org.apache.spark.sql.functions._
import org.apache.spark.sql.SparkSession
object DataFrameWithFileNameApp extends App {
val spark: SparkSession =
SparkSession
.builder()
.appName("DataFrameApp")
.config("spark.master", "local[*]")
# Root logger option
log4j.rootLogger=INFO, stdout
# Redirect log messages to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %t %c:%L - %m%n
log4j.com.ncr.eda=INFO, stdout
@yaravind
yaravind / spark-shell-init-load-file
Last active April 10, 2020 01:38
init file to load spark imports etc. You can use :load macro in the shell
:paste
import org.apache.spark.sql.types._
import com.databricks.spark.xml._
import org.apache.spark.sql.functions._
// For implicit conversions like converting RDDs to DataFrames
import spark.implicits._